PDF Export Command Line Parameters

The PDF filter accepts a string of options containing PDF properties for export.

Examples:

Windows Command Prompt CMD

The double quotes in the parameter string must be escaped (\").

To export pages 2 to 5 of a Writer document:

"C:\Program Files\LibreOffice\program\soffice" --convert-to pdf:writer_pdf_Export:{\"PageRange\":{\"type\":\"string\",\"value\":\"2-5\"}} --outdir C:\Users\myuser\Documents C:\Users\myuser\Documents\myfile.odt

To add a tiled watermark:

"C:\Program Files\LibreOffice\program\soffice" --convert-to pdf:draw_pdf_Export:{\"TiledWatermark\":{\"type\":\"string\",\"value\":\"draft\"}} C:\Users\myuser\Documents\test.odg

To encrypt a file:

"C:\Program Files\LibreOffice\program\soffice" --convert-to pdf:draw_pdf_Export:{\"EncryptFile\":{\"type\":\"boolean\",\"value\":\"true\"},\"DocumentOpenPassword\":{\"type\":\"string\",\"value\":\"secret\"}} test.odg

To set version 1.5 (instead of the default 1.7):

"C:\Program Files\LibreOffice\program\soffice" --convert-to pdf:draw_pdf_Export:{\"SelectPdfVersion\":{\"type\":\"long\",\"value\":\"15\"}} test.odg

Windows PowerShell

The parameter string must be wrapped in single quotes to allow parsing of the double quotes. The ampersand (&) character is known as the call operator. It is used to execute a command, script block, or function stored in a variable or string.

To export pages 2 to 5 of a Writer document:

& 'C:\Program Files\LibreOffice\program\soffice' --convert-to 'pdf:writer_pdf_Export:{"PageRange":{"type":"string","value":"2-5"}}' --outdir C:\Users\myuser\Documents C:\Users\myuser\Documents\myfile.odt

To add a tiled watermark:

& 'C:\Program Files\LibreOffice\program\soffice' --convert-to 'pdf:draw_pdf_Export:{"TiledWatermark":{"type":"string","value":"draft"}}' test.odg

To encrypt a file:

& 'C:\Program Files\LibreOffice\program\soffice' --convert-to 'pdf:draw_pdf_Export:{"EncryptFile":{"type":"boolean","value":"true"},"DocumentOpenPassword":{"type":"string","value":"secret"}}' test.odg

To set version 1.5 (instead of the default 1.7):

& 'C:\Program Files\LibreOffice\program\soffice' --convert-to 'pdf:draw_pdf_Export:{"SelectPdfVersion":{"type":"long","value":"15"}}' test.odg

Linux (BASH) and MacOS (ZSH)

To export pages 2 to 5 of a Writer document:

soffice --convert-to 'pdf:writer_pdf_Export:{"PageRange":{"type":"string","value":"2-5"}}' --outdir /home/myuser myfile.odt

To add a tiled watermark:

soffice --convert-to 'pdf:draw_pdf_Export:{"TiledWatermark":{"type":"string","value":"draft"}}' test.odg

To encrypt a file:

soffice --convert-to 'pdf:draw_pdf_Export:{"EncryptFile":{"type":"boolean","value":"true"},"DocumentOpenPassword":{"type":"string","value":"secret"}}' test.odg

To set version 1.5 (instead of the default 1.7):

soffice --convert-to 'pdf:draw_pdf_Export:{"SelectPdfVersion":{"type":"long","value":"15"}}' test.odg

Index

General Properties

Initial View

User Interface

Links

Security

Digital Signature

General Properties

General

Name

Description

Type

Default Value

PageRange

If this property is set, it indicates the range of pages to be exported.

To export all the pages, leave this property unset.

To export a selection, leave this property unset and set only the property Selection.

string

Empty (all pages are exported)

Selection

An any corresponding to the current selection in the document.

Any

UseLosslessCompression

Specifies if images are exported to PDF using a lossless compression format like PNG or compressed using the JPEG format.

boolean

false

Quality

Specifies the quality of the JPG export. A higher value produces a higher-quality image and a larger file.

Minimum inclusive value: 1. Represents the lowest value that can be used. The lower the value, the worse is the image quality and the smaller is the file size.

Maximum inclusive value: 100. Represents the highest value that can be used. The higher the value, the better is the image quality and the larger is the file size.

long

90

ReduceImageResolution

Specifies if the resolution of each image is reduced to the resolution specified by the property