(Solved) Convert to pdf with specific settings (from command)

Is it possible to convert to PDF with specific PDF-options from the command line?

My specific problem is that I would like to force PDF/A 1a.
I have found that the property is this:

<item oor:path="/org.openoffice.Office.Common/Filter/PDF/Export"><prop oor:name="SelectPdfVersion" oor:op="fuse"><value>1</value></prop></item>

LibreOffice stores this and other settings in the user profile file. But is it somehow possible to parse specific options from command line.

I’m looking for something like -outfilter similar to -infilter.

There is no “outfilter” command line parameter - because it’s not needed: export filter parameters are optionally passed to --export-to after a comma after output extension - see documentation.

Still - there is no such PDF export filter parameter, and thus you only can use a dedicated pre-configured user profile (create one and copy to some directory), using -env:UserInstallation=file:///path/to/profile/with/pdf/a/config.

Hi friend,

I’m trying to define the margins before converting the PDF, without embago I could not.

You can help me?

Thank you

There is now, since commit 0c3b8792b712e939d2ad524d554f96616b4844be. It will be available in version 7.4.

2 Likes

Mike - I have been reading with interest the capabilities of OpenOffice and in particular the ability or not to create a PDF/A from the command line which in various threads you seem to suggest it now (v7.4+) is possible. Using the commentary in this thread I have the following command line but the resulting PDF (which looks great otherwise) I see no obvious watermark:

soffice --convert-to pdf:draw_pdf_Export:{“TiledWatermark”:{“type”:“string”,“value”:“draft”}} “c:\gluckli\libre\in\Very small file test.docx”

The version of Open Office (portable in my case) is LibreOffice 7.4.5.1 9c0871452b3918c1019dde9bfac75448afc4b57f.

Am I doing something incorrect or misunderstanding something (quite possible :slight_smile: ) ? If so can you help me to see the error of my ways ? Even better if this works is the production of a PDF/A possible and if so how from the command line ?

Thinking something like:

–convert-to pdf:writer_pdf_Export:{“SelectPdfVersion”:{“type”:“long”,“value”:“1”}}

Any help greatly appreciated.

See Libreoffice .xls to .pdf conversion breaks single page content into multiple pages on Ubuntu 18.04 - #2 by mikekaganski

and Passing in JSON parameters into Writer for the --convert-to option - #5 by mikekaganski

1 Like

In 2023 (LibreOffice 7.5) export filter parameters can be passed using a kind of generalized property-value syntax. For example, to create a password protected PDF (white space can be used at will):

libreoffice --convert-to 'pdf:writer_pdf_Export:{
  "EncryptFile":{"type":"boolean","value":"true"},
  "DocumentOpenPassword":{"type":"string","value":"secret1"},
  "PermissionPassword":{"type":"string","value":"secret2"}
}'  --outdir /where/to/store/results  inputfile.odt

And this creates PDF/A-3 files:

libreoffice --convert-to 'pdf:writer_pdf_Export:{
  "SelectPdfVersion":{"type":"long","value":3}
}' input.odt

These are now documented at PDF CLI Parameters