Ask Your Question
0

How to convert documents to PDF on OSX

asked 2013-02-13 19:07:07 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

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 4.0.0.3. 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!

edit retag flag offensive close merge delete

Comments

how would you specify the output folder?

kpcurt0 gravatar imagekpcurt0 ( 2013-02-13 21:56:45 +0100 )edit

2 Answers

Sort by » oldest newest most voted
2

answered 2013-02-13 19:52:04 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi,

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:
cd /Applications/LibreOffice.app/Contents/MacOS
  • then you can run the same command as you used in Linux:
./soffice --headless --convert-to <extention> <path+file>

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
    For example:
 ./soffice --headless --convert-to pdf --outdir /home/user ~/Downloads/*.odt
  • For other options or help you can use:
./soffice --help

Kind regards,
Joren

edit flag offensive delete link more

Comments

Hi 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? Thanks Peter

GeriSoft gravatar imageGeriSoft ( 2013-12-26 20:33:26 +0100 )edit

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 4.2.6.3, on Mac OS X 10.10

Thanks

karlcdk gravatar imagekarlcdk ( 2015-04-19 19:47:53 +0100 )edit
0

answered 2015-04-29 08:48:54 +0100

psjinx gravatar image

updated 2015-04-29 08:51:20 +0100

Quick Start

sudo curl sudo curl https://gist.githubusercontent.com/psjinx/3ad78df6290b5ba931c1/raw/soffice.sh > /usr/loca/bin/soffice && sudo chmod +x /usr/loca/bin/soffice

Create a shell script at /usr/loca/bin/soffice with following content

#!/bin/bash

# Need to do this because symlink won't work
# It complains about some .plist files
/Applications/LibreOffice.app/Contents/MacOS/soffice "$@"

Make it executable

sudo chmod +x /usr/loca/bin/soffice

Usage

Now you can run soffice command from anywhere

Convert an excel file to pdf

soffice --headless --convert-to pdf:"calc_pdf_Export" /path/to/some/.xlsx/file
edit flag offensive delete link more

Comments

The exact solution I was looking for =D Thanks !

Jean24 gravatar imageJean24 ( 2015-07-09 14:46:40 +0100 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-02-13 19:07:07 +0100

Seen: 13,042 times

Last updated: Apr 29 '15