PDF CLI Parameters

Contents

# 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 MaxImageResolution. | boolean | false
MaxImageResolution | If the property ReduceImageResolution is set to true, all images will be reduced to the given value in DPI. Possible values are: 75, 150, 300, 600 and 1200. | long | 300
SelectPdfVersion | Specifies the PDF version to emit. Possible values are: 0: PDF 1.7 (default choice). 1: PDF/A-1b 2: PDF/A-2b 3: PDF/A-3b 15: PDF 1.5 16: PDF 1.6 17: PDF 1.7 | long | 0
PDFUACompliance | Creates an accessible PDF file that follows the requirements of the PDF/UA (ISO 14289) specification. | boolean | false
UseTaggedPDF | Determines if PDFs are created using special accessibility tags. | boolean | false
ExportFormFields | Specifies whether form fields are exported as widgets or only their fixed print representation is exported. | boolean | true
FormsType | Specifies the submit format of a PDF form. Possible values are: 0: Specifies that form type FDF is used. 1: Specifies that form type PDF is used. 2: Specifies that form type HTML is used. 3: Specifies that form type XML is used. | long | 0
AllowDuplicateFieldNames | Specifies whether multiple form fields exported are allowed to have the same field name. | boolean | false
ExportBookmarks | Specifies if bookmarks are exported to PDF. | boolean | true
ExportPlaceholders | Export the placeholders fields visual markings only. The exported placeholder is ineffective. | boolean | false
ExportNotes | Specifies if notes are exported to PDF. | boolean | false
ExportNotesPages | Specifies if notes pages are exported to PDF. (Notes pages are available in Impress documents only). | boolean | false
ExportOnlyNotesPages | If the property ExportNotesPages is set to true, specifies if only notes pages are exported to PDF. | boolean | false
ExportNotesInMargin | Specifies if notes in margin are exported to PDF. | boolean | false
ExportHiddenSlides | For LibreOffice Impress, exports slides not included in slide shows. | boolean | false
IsSkipEmptyPages | Specifies that automatically inserted empty pages are suppressed. This option is active only if storing Writer documents. | boolean | false
EmbedStandardFonts | Specifies whether to embed the 14 standard PDF fonts or not. | boolean | false
IsAddStream | Specifies that a stream is inserted to the PDF file which contains the original document for archiving purposes. | boolean | false
Watermark | Specifies the text for a watermark to be drawn on every page of the exported PDF file. | string | (empty)
WatermarkColor | Specifies the color of the watermark text | long | 8388223 (light green)
WatermarkFontHeight | Specifies the font height of the watermark text. | long |
WatermarkRotateAngle | Specifies angle of the watermark text. | long |
WatermarkFontName | Specifies font name of the watermark text. | string | Helvetica
TiledWatermark | Specifies the tiled watermark text. | string |
UseReferenceXObject | When the option is enabled, then the reference XObject markup is used: this is a simple operation, but viewers have to support this markup to show vector images. Otherwise a fallback bitmap is shown in the viewer. | boolean | false
IsRedactMode |  | boolean | false
SinglePageSheets | Ignores each sheet’s paper size, print ranges and shown/hidden status and puts every sheet (even hidden sheets) on exactly one page. | boolean | false

## Initial View

Initial View

Name | Description | Type | Default Value
--- | --- | --- | ---
InitialView | Specifies how the PDF document should be displayed when opened. Possible values are: 0: Select the default viewer mode, neither outlines nor thumbnails. 1: The document is opened with outline pane opened 2: The document is opened with thumbnail pane opened | long | 0
InitialPage | Specifies the page on which a PDF document should be opened in the viewer application. | long | 1
Magnification | Specifies the action to be performed when the PDF document is opened. Possible values are: 0: Opens with default zoom magnification. 1: Opens magnified to fit the entire page within the window. 2: Opens magnified to fit the entire page width within the window. 3: Opens magnified to fit the entire width of its bounding box within the window (cuts out margins). 4: Opens with the zoom level specified in the Zoom property. | long | 0
Zoom | Specifies the zoom level a PDF document is opened with. Only valid if Magnification is set to "4". | long | 100
PageLayout | Specifies the page layout to be used when the document is opened. Possible values are: 0: Display the pages according to the reader configuration. 1: Display one page at a time. 2: Display the pages in one column. 3: Display the pages in two columns odd pages on the right, to have the odd pages on the left the FirstPageOnLeft property should be used as well. | long | 0
FirstPageOnLeft | Used with the value 3 of the PageLayout property above, true if the first page (odd) should be on the left side of the screen. | boolean | false

## User Interface

User Interface

Name | Description | Type | Default Value
--- | --- | --- | ---
ResizeWindowToInitialPage | Specifies that the PDF viewer window is opened showing whole initial page when the document is opened. | boolean | false
CenterWindow | Specifies that the PDF viewer window is centered to the screen when the PDF document is opened. | boolean | false
OpenInFullScreenMode | Specifies that the PDF viewer window is opened full screen, on top of all windows. | boolean | false
DisplayPDFDocumentTitle | Specifies that the title of the document, if present in the document properties, is displayed in the PDF viewer window title bar. | boolean | true
HideViewerMenubar | Specifies whether to hide the PDF viewer menubar when the document is active. | boolean | false
HideViewerToolbar | Specifies whether to hide the PDF viewer toolbar when the document is active. | boolean | false
HideViewerWindowControls | Specifies whether to hide the PDF viewer controls when the document is active. | boolean | false
UseTransitionEffects | Specifies slide transitions are exported to PDF. This option is active only if storing Impress documents. | boolean | true
OpenBookmarkLevels | Specifies how many bookmark levels should be opened in the reader application when the PDF gets opened. Possible values are: -1: all bookmark levels are opened 1–10: indicate a bookmark level (from 1 to 10) | long | -1

## Links

Links

Name | Description | Type | Default Value
--- | --- | --- | ---
ExportBookmarksToPDFDestination | Specifies that the bookmarks contained in the source LibreOffice file should be exported to the PDF file as Named Destination. | boolean | false
ConvertOOoTargetToPDFTarget | Specifies that the target documents with .od[tpgs] extension, will have that extension changed to .pdf when the link is exported to PDF. The source document remains untouched. | boolean | false
ExportLinksRelativeFsys | Specifies that the file system related hyperlinks (file:// protocol) present in the document will be exported as relative to the source document location. | boolean | false
PDFViewSelection | Specifies the way the exported PDF will be viewed (experienced) by the user. Possible values are: 0: Specifies that the PDF will be exported with all the links external to the document treated as URI. This is the Default 1: Specifies that the PDF will be exported in order to be viewed through a PDF reader application only. Valid only if not exporting to PDF/A-1 (e.g. SelectPdfVersion not set to 1). 2: Specifies that the PDF will be exported in order to be viewed through an Internet browser, using the PDF plug-in provided with it. The bookmark of the URI will be rendered compatible with the target bookmark generated with LibreOffice PDF Export feature (see ExportBookmarksToPDFDestination). | long | 0

## Security

Security

Name | Description | Type | Default Value
--- | --- | --- | ---
EncryptFile | If true, selects to encrypt the PDF document with a password. The PDF file can be opened only when the user enters the correct password. | boolean | false
DocumentOpenPassword | This is the password that allows the user to open the PDF file when EncryptFile is set to true. | string |
RestrictPermissions | If true, selects to restrict some permissions. The permissions can be changed only when the user enters the correct password. | boolean | false
PermissionPassword | This is the password that allows the user to access some permissions restricted if RestrictPermissions is set to true. | string |
PreparedPasswords |  |  |
PreparedPermissionPassword |  | string |
Printing | Specifies what printing is allowed. Possible values are: 0: The document cannot be printed. 1: The document can be printed at low resolution only. 2: The document can be printed at maximum resolution. | long | 2
Changes | Specifies the changes that can be made to the document. Possible values are: 0: The document cannot be changed. 1: Inserting deleting and rotating pages is allowed. 2: Filling of form field is allowed. 3: Both filling of form field and commenting is allowed. 4: All the changes of the previous selections are permitted, with the only exclusion of page extraction (copy). | long | 4
EnableCopyingOfContent | Specifies that the pages and the document content can be extracted to be used in other documents (copy and paste). | boolean | true
EnableTextAccessForAccessibilityTools | Specifies that the document content can be extracted to be used in accessibility applications. | boolean | true

## Digital Signature

Digital Signatures

Name | Description | Type | Default Value
--- | --- | --- | ---
SignPDF | If true, sign the PDF. | boolean | false
SignatureLocation | Additional information about the digital signature, location of the signatory. | string |
SignatureReason | Additional information about the digital signature, reason for signature. | string |
SignatureContactInfo | Additional information about the digital signature, signatory contact information. | string |
SignaturePassword | Certificate password | string |
SignatureCertificate |  |  |
SignCertificateSubjectName |  | string |
SignatureTSA | During the PDF signing process, the timestamp authority URL will be used to obtain a digitally signed timestamp that is then embedded in the signature. | string |

Please support us!