6

This works to export a PDF:

C:\Program Files\LibreOffice\program\soffice.exe --headless --convert-to pdf test.doc --outdir .

but it doesn't allow to change the output filename. I found the option to change the output directory, but how to change the output filename?

Basj
  • 2,143

2 Answers2

2

There doesn't appear to be a straightforward way to directly do this. Instead (elaborating on the answer provided by JJ_Coder4Hire), as a workaround, one might create a dedicated output directory and and then rename the file generated by soffice:

mkdir /tmp/soffice_output_dir
soffice --headless --convert-to odt  --outdir /tmp/soffice_output_dir xyz.html
mv /tmp/soffice_output_dir/xyz.odt /path/to/the_desired_name.odt
0

Just rename it after it saves. it will be the exact name with .pdf on the end.