Converting to pdf via CLI with parameters

Hello, LibreOffice 6.4 supports exporting spreadsheets as PDF using the Full-sheet previews parameter, I was wondering if it’s possible to pass this parameter when converting files to pdf via the command line in headless mode ?

What we currently use is:

./soffice --headless --invisible --nodefault --view --nolockcheck --nologo --norestore --nofirststartwizard --convert-to pdf myspreadsheet.xlsx
1 Like

By the way: why do you use --view here? This switch tells “all following files should be opened for read-only view”, but then you don’t supply any files (of course, because you use headless mode, which would make those files opened invisibly), but instead use --convert-to which cancels the previous --view.

Hi Mike, thanks for the reply. I’m not sure about most of the options passed to the convert-to command actually, I use a third-party library that constructs the options for me, but thanks for the input, I’ll put it a pull request to remove the unnecessary options.

Regarding the original question, I did notice that opening up Libre Office in the UI and exporting the pdf using Full sheet preview option works fine, and the option gets saved for future exports through the CLI. The problem is that I use LO for converting files to pdf as a AWS Lambda function, therefore I have no chance of opening it up in the UI and solving the problem this way.
Is there a way to manually edit some config files and set the Full sheet preview option to true by default, without any input through the UI ?

The option (as almost every other option) is stored in registrymodifications.xcu file of user profile. You may find options you are interested in by backing up your registrymodifications.xcu file, then opening LO, making necessary changes, closing it, and comparing the old and new registrymodifications.xcu. Specifically in this case, it’s

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

Thanks Mike !