Ask Your Question

Docx to PDF on windows using command line fails

asked 2015-05-08 21:29:16 +0200

Jahren gravatar image

updated 2015-08-28 13:52:56 +0200

Alex Kemp gravatar image

Hi, I'm trying to convert a docx to pdf using the command line on windows 7 but it will fail silently. I see that it creates a temporary file called .~lock.a.pdf# in the outpour dir. (the original file is called a.docx) I see the soffice.exe and soffice.bin processes in the task manager for a few seconds then shuts down. The temporary remains but no PDF or error or anything.

Im using libreoffice 4 from windows powershell (tried regular command line too) with this command: &("C:\Program Files (x86)\Appz\LibreOffice 4\program\soffice.exe") -headless -convert-to pdf:writer_pdf_Export -outdir C:\TEST\PDF C:\TEST\a.docx

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-09-06 19:48:15 +0200

rpr gravatar image

On MS Windows 7 Pro. SP1 with LibreOffice 5.0.1 I was able to convert a rather complex 150-pages DOCX to PDF by running the following in cmd.exe:

"C:\Program Files (x86)\LibreOffice 5\program\soffice.exe" -headless -convert-to pdf:writer_pdf_Export -outdir C:\temp C:\temp\a.docx

After a couple of minutes of processing the C:\temp\a.pdf file was created.

I noticed that the command does nothing if another instance of LibreOffice (that is soffice.exe) is running at the time the command is invoked.

Are you able to export that DOCX file to PDF manually? Could you attach the a.docx file you tried to convert?

edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2015-05-08 21:29:16 +0200

Seen: 3,618 times

Last updated: Sep 06 '15