LibreOffice cannot only convert DOCX to PDF on the command line: infilter="Microsoft Word 2007 XML Template" infilter="Microsoft Word 97/2000/XP Template" infilter="Microsoft Word 2007-2013 XML Template" Remaining arguments will be treated as filenames or URLs of documents to open.Īdd one more argument to your command line to enforce the application of an input filter when soffice opens your DOCX file: -infilter="Microsoft Word 2007/2010/2013 XML" env:UserInstallation=file:///tmp/test to set a non-default user profile path. print-to-file -printer-name nasty_lowres_printer -outdir /home/user *.docĭump text content of the files to consoleĮg. convert-to "txt:Text (encoded):UTF8" *.doc convert-to "html:XHTML Writer File:UTF8" *.doc convert-to pdf:writer_pdf_Export -outdir /home/user *.doc If -outdir is not specified then current working dir is used as output_dir. Use -unnaccept=all to close all open acceptors Other programs can connect to access the APIĬlose an acceptor that was created with -accept= Specify an UNO connect-string to create an UNO acceptor through which Open the specified presentation and start it immediately Open the specified documents in viewer-(readonly-)mode. Print the specified documents on the specified printer. Print the specified documents on the default printer. Specify X-Display to use in Unix/X11 versions. n always open documents as new files (use as template). o open documents regardless whether they are templates or not. version display the version information. headless like invisible but no userinteraction at all. nodefault don't start with an empty document nolockcheck don't check for remote instances using the installation quickstart starts the quickstart service norestore suppress restart/restore after fatal errors. invisible no startup screen, no default document and no UI. minimized keep startup bitmap minimized.
Last: Use full path to soffice, to soffice.bin and to libreoffice and run each with the -h parameter: $ /path/to/libreoffice -h Repeat step 8, but make sure to reference the ODT this time. If it again doesn't work, repeat step 7, but save as ODT this time. Write "Hello World!" on an otherwise empty page. So create a very simple DOCX document of your own first. It may be a problem with the specific DOCX file you try the command with.
This works for me on Mac OS X Mavericks 10.9.5 with LibreOffice v4.4.3.2 (using my specific path for the binary soffice which will be different for you anyway.). Add this additional parameter to your command: "-env:UserInstallation=file:///tmp/LibreOffice_Conversion_$" \ Next, the command will not work if there is already a LibreOffice GUI instance up and running on your system. It needs to be: -convert-to pdf:writer_pdf_Exportīe sure to follow exactly this capitalization! Then, your -convert-to pdf is not sufficient. I suspect that the libreoffice binary does not work - you have to locate the soffice binary and see if that works. I would first of all try it with giving absolute paths to the command.