Ask Your Question

convert files to PDF/A on command line, headless mode [closed]

asked 2012-05-11 20:44:13 +0200

bhui gravatar image

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 :-)

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-10-16 03:52:05.329474

3 Answers

Sort by » oldest newest most voted

answered 2012-05-12 14:08:48 +0200

w_whalley gravatar image

updated 2012-05-13 02:30:20 +0200

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.

edit flag offensive delete link more

answered 2012-05-12 21:12:26 +0200

bhui gravatar image

@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: (specifically the SelectPdfVersion property).

edit flag offensive delete link more


@bhui A possible alternative method is to change the configuration file. See the edit in my answer (not enough space here.

w_whalley gravatar imagew_whalley ( 2012-05-13 02:23:53 +0200 )edit

answered 2012-05-21 15:25:03 +0200

dag gravatar image

Or you can use unoconv like this:

unoconv -f pdf -eSelectPdfVersion=1 your-file.odt
edit flag offensive delete link more

Question Tools



Asked: 2012-05-11 20:44:13 +0200

Seen: 16,163 times

Last updated: May 21 '12