Skip to content

Instantly share code, notes, and snippets.

@first-developer
Forked from diogo-almeida/docx2pdf
Created February 11, 2016 13:16
Show Gist options
  • Save first-developer/3da9f265f04cb7ee47cc to your computer and use it in GitHub Desktop.
Save first-developer/3da9f265f04cb7ee47cc to your computer and use it in GitHub Desktop.
Batch .docx conversion to .pdf using LibreOffice from the command line
# Path of LibreOffice installation
cd /Applications/LibreOffice.app/Contents/MacOS
# General command
./soffice --headless --convert-to <extension> <path+file>
# Automatically convert all .odt files to pdf
./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
# Options
./soffice --help
# found at: http://ask.libreoffice.org/en/question/12084/how-to-convert-documents-to-pdf-on-osx/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment