Hey, I need to convert various kinds of documents (.docx, .doc, .rtf, .odt, others) to PDF/A format using libreoffice in headless mode from the command line (linux). What would the command be for doing this? Specifically, what do I give as the “-convert-to” parameter? TIA
This link explains that the headless PDF conversion uses the last options set in the GUI PDF conversion, so the solution is to set the PDF/A option in the GUI then use the headless mode.
Or you can change the configuration file. The only thing that seems to be changed when the PDF/A option is toggled on is a number in the .libreoffice/3/user/registrymodifications.xcu file. The entry
<item oor:path="/org.openoffice.Office.Common/Filter/PDF/Export"><prop oor:name="SelectPdfVersion" oor:op="fuse"><value>0</value></prop></item> has the value changed from 0 to 1.
The xcu file seems to be mostly one long line, so it isn’t clear to me how best to edit it.
@w_whalley Thanks! Huh, interesting. Doesn’t sound all that stable for a production environment where we want the behavior to be consistent…I have a feeling that I’ll end up writing a Python script to do the whole thing (including setting the property programmatically). I had hoped to be able to use a neat one-liner, but I guess sometimes entire scripts are necessary
For anybody interested in what I’m using for the solution, see here: http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export (specifically the SelectPdfVersion property).
@bhui A possible alternative method is to change the configuration file. See the edit in my answer (not enough space here.
Or you can use unoconv like this:
unoconv -f pdf -eSelectPdfVersion=1 your-file.odt