I have seen posts on how to batch convert various documents to PDF via command line for both windows and linux. Now OSX being unix based I figure it must be similar to the linux posts but I have yet to figure out the correct syntax. Im using LibreOffice 220.127.116.11. on OSX 10.6.8. I aslo have access to Acrobat Pro 9 on this machine if someone knows of a better way to do the batch conversion and can point me in the right direction with that. Thanks in advance!
how would you specify the output folder?
You can do the same using the Terminal in Mac OSX (tested using Mac OSX 10.8.2).
- Open Terminal
- cd to your LibreOffice installation like:
- then you can run the same command as you used in Linux:
./soffice --headless --convert-to
Example to convert all odt files to pdf in my Downloads folder:
./soffice --headless --convert-to pdf ~/Downloads/*.odt
- To specify an output folder you can add the --outdir option
./soffice --headless --convert-to pdf --outdir /home/user ~/Downloads/*.odt
- For other options or help you can use:
I tried this with 10 files for test, succes.
But not works on the full folder (contains 4500 doc files)
Terminal said too many arguments
What is the limit?
Not working… Once in LibreOffice installation I used this syntax:
./soffice --headless --convert-to pdf --outdir ~/Desktop /Users/user/Desktop/*.doc
And returns this:
/Applications/LibreOffice.app/Contents/MacOS/–-headless does not exist.
/Applications/LibreOffice.app/Contents/MacOS/–-convert-to does not exist.
/Applications/LibreOffice.app/Contents/MacOS/pdf does not exist.
/Applications/LibreOffice.app/Contents/MacOS/—-outdir does not exist.
Using 18.104.22.168, on Mac OS X 10.10
sudo curl sudo curl https://gist.githubusercontent.com/psjinx/3ad78df6290b5ba931c1/raw/soffice.sh > /usr/loca/bin/soffice && sudo chmod +x /usr/loca/bin/soffice
#!/bin/bash # Need to do this because symlink won't work # It complains about some .plist files /Applications/LibreOffice.app/Contents/MacOS/soffice "$@"
sudo chmod +x /usr/loca/bin/soffice
Now you can run
soffice command from anywhere
soffice --headless --convert-to pdf:"calc_pdf_Export" /path/to/some/.xlsx/file
The exact solution I was looking for =D Thanks !
I tried but without result with this command shell
cmd="/Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf /Users/lismax/Desktop/MioFile.rtf"
where I’m wrong ?
Please don’t post a question as an answer. Do post a new question giving as much relevant detail as possible. Do also feel free to link back to this Q&A. Then delete this “answer”! (Or a moderator might do that for you.) Thanks.