Headless convert password-protected Word File to PDF

Hello

I’m using Ubuntu Server 12.04 64bit and LibreOffice 3.5 (from the official Ubuntu repository). My Java EE application needs to convert Word files (.doc and .docx) to PDF on the commandline.

Converting a non-password-protected Word file works like a charm. If I try to convert a password-protected Word file (.doc, .docx) to PDF, it fails without any stderr, e.g.:

server:~/pdftest# /usr/bin/libreoffice --headless -convert-to pdf ‘myFile.doc’ -outdir ‘/root/pdftest/’

Does somebody know what I’m doing wrong here or is this the regular behavior?

EDIT: If the goal is not clear: my Java application needs an output, which identifies failed conversion in order to handle the file in another way.

EDIT2: I’m aware of the possibility to check if there is a PDF after the conversion. If the PDF is not available, then I know, the conversion failed. But in my opinion it would be better, if the command throws an exception or asks for the password at least, but just doing nothing is a bit strange.

Thank you very much,
Marco

What type of DOC/X are they and in which application were they created (e.g., MSO 2007, 2010, 2013)? Support for Microsoft Office 2010 and 2013 Agile decryption is coming in LO v4.2. If you can’t wait until February 2014 for that release I advise grabbing a daily build of master to see if that fixes the issue. Just realised you are running Ubuntu. You may have to wait.

Thank you very much for your reply. Both files are created with MS 2013. The “.doc” file is a Word 97-2003 type and for the “.docx” I guess it is Word 2007-2013. Unfortunately I cannot wait. Now, the application checks, if the PDF is created or not, regardless of stdout and stderr.