I have many .odt files in my Windows system. I would like to convert these files to PDF. I tried that in command line
soffice.bin --headless -convert-to pdf:"writer_pdf_Export" c:\MyOdtFile.odt
But, It does not work. This method can only open file, does not convert! How can I do this?
With LibreOffice, the following command should work:
soffice.exe --headless -convert-to pdf --outdir <output directory> <file1.odt> <file2.odt>
When converting to pdf, -convert-to pdf
is sufficient. The --outdir
parameter is optional; if you don't use it, the PDF will be created in the current working directory. Using soffice.bin
didn't work for me (missing sal3.dll), but soffice.exe
works (LibreOffice 4.2.4.2, Win 7). If soffice.exe
isn't in your path, you would have to set the PATH explicitly or add the complete path to the command above:
' "C:\Program Files (x86)\LibreOffice 4\program\soffice.exe" --headless -convert-to pdf --outdir C:\temp test1.odt`
Make sure that LO isn't running when issuing the convert command - otherwise the conversion will fail without an error message.