Batch Convert Word to PDF WITHOUT having MS Word installed on Mac?

Hi all - the holy grail of mac questions! How can I batch convert Word (Docx) to PDF in OSX wthout having MS Word installed?


OSX Pages is a manual document by document so that's not an option. 3rd party apps like 'PDF Element' ONLY batch convert if you have MS Word installed on your Mac. Automator doesn't seem to work on Catalina for the old school work arounds.


So is there an easy way of doing this?


Or is there a reasonable priced 3rd party app that can do this WITHOUT having to have MS Word installed? Thanks for any insight anyone can offer.

MacBook Pro 13″, macOS 10.15

Posted on May 31, 2023 4:00 AM

Reply
7 replies

May 31, 2023 5:33 AM in response to John__Watson

You might be able to do it using LibreOffice and Terminal commands.


https://www.libreoffice.org/

https://www.libreofficehelp.com/batch-convert-writer-documents-pdf-libreoffice/

https://ask.libreoffice.org/t/how-to-convert-documents-to-pdf-on-osx/3137


On my Mac, /Applications/LibreOffice.app/Contents/MacOS/soffice seems to be the location of the program that you can run in --headless --convert-to-pdf mode (see second link).


May 31, 2023 5:42 AM in response to Servant of Cats

Note that when using shell commands, you have to escape certain special characters (like spaces) in filenames.


E.g., ls /User\ Guides\ And\ Information with a backslash before each space.


Not ls /User Guides And Information which the shell will interpret as a request to list /User, Guides, And, and Information, none of which exist.


If you drag and drop files (other than .textclipping files) into Terminal, it will generally add their names to the end of the command line with all of the escape character stuff taken care of for you.


May 31, 2023 9:14 AM in response to John__Watson

The Linux instructions won’t work as written in Mac OS X, but they pointed the way. On the Mac, the Unix command line program is called ‘soffice’ and it is buried within the package that makes up the Mac GUI application. So you can do the batch conversion with a relatively small (but important) variation on the instructions.


That is what the second link (and the text of my post) are about.


There are ways to set up things in the shell so that you don’t have to type that really long path (/Applications/…/soffice) again and again. I’m typing on my iPhone now, but maybe when I get back to my Mac, I’ll whip up a file for you.

May 31, 2023 10:40 AM in response to Servant of Cats

OK, here we go. You're using Catalina, so I believe the default shell for your system is 'zsh' instead of 'bash', which was the default under High Sierra.


Create a plain text file that contains the line

alias batch_convert="/Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf"


You can do this in TextEdit, but you will need to select the "Make Plain Text" item in the Format menu before it will allow you to save the file as plain text. Save the file. Run Terminal. At the command prompt, type the following 'ls' (directory) command. This is just to check that you don't already have an initialization script (if you did, then you'd probably want to add that line to it, rather than overwriting all of the old commands).


% ls .zshrc

ls: .zshrc: No such file or directory


Now type cp, and a space. Drag and drop the file you saved with TextEdit into the Terminal window. Type another space, then .zshrc (with a leading '.'). You'll see a command like this (where dragging and dropping the Finder file will have filled in its entire Unix pathname for you).

% cp /Users/-----/Desktop/ZSHRC.TXT .zshrc


Hit RETURN. Now when zsh starts, your .zsh will set up a "batch_convert" convenience command. Exit Terminal and launch it again (to restart zsh and make it set up the alias.)


Now, if you have some Word files, e.g.,

% ls *.pdf

Word Test Document One.pdf Word Test Document Two.pdf


You can do a

% batch_convert Word\ Test\ Document\ One.docx Word\ Test\ Document\ Two.docx


LibreOffice will print

convert /Users/-----/Word Test Document One.docx -> /Users/-----/Word Test Document One.pdf using writer_pdf_Export

convert /Users/-----/Word Test Document Two.docx -> /Users/-----/Word Test Document Two.pdf using writer_pdf_Export


and a directory listing will then show

% ls *.pdf

Word Test Document One.pdf Word Test Document Two.pdf


I checked the .PDF files with Preview, and their contents looked fine to me.


I tried doing a

% batch_convert *.docx

and that worked too – the spaces in the filenames didn't throw it off, the way they would if I typed them without escape prefixes on the command line. (When I did that, LibreOffice appeared to do nothing; it did not generate any .PDF files, or any success messages, but it also didn't generate any error messages.)


If you wanted to use the --outdir directory option shown in the third link (batch conversion on OS X), you would just type

% batch_convert --outdir directory input_files


Batch Convert Word to PDF WITHOUT having MS Word installed on Mac?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.