Skip to content

Instantly share code, notes, and snippets.

@diogo-almeida
Last active July 23, 2023 22:25
Show Gist options
  • Star 25 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save diogo-almeida/9339203 to your computer and use it in GitHub Desktop.
Save diogo-almeida/9339203 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/
@cvdenzen
Copy link

typo: extension is with an s.

@mdarby
Copy link

mdarby commented Nov 30, 2014

<3

@diogo-almeida
Copy link
Author

@cvdenzen: Thanks for catching the typo!

@constantm
Copy link

thanks! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment