Convert batch of Word files to PDFs in Mac OS X
One option using the command line would be to use pandoc (which requires LaTeX for PDF generation).
- Install pandoc and LaTeX. Because LaTeX is so big, I installed BasicTeX as recommended in the pandoc docs. With Homebrew and Homebrew Cask:
brew install pandoc && brew install --cask basictex
- Make sure the Word files are in .docx format. If they are in .doc format, you can convert them with OS X's built-in
textutil
:textutil -convert docx *.doc
- On El Capitan you have to add the texbin utilities to your PATH:
export PATH=/Library/TeX/texbin:"$PATH"
- Convert:
pandoc -o myfile.pdf myfile.docx
Because your question was regarding batch converting multiple files, you could easily put this into a loop:
#! /bin/bash
for file in *.doc; do
textutil -convert docx "$file"
# Account for the new `x` in `docx`
pandoc -o "${file%doc}pdf" "${file}x"
done
You can use the docx2pdf
command line utility to batch convert docx to pdf on macOS (or windows). It uses Microsoft Word's APIs to directly convert to PDF creating a perfect copy. It uses JXA (Javscript for Automation, basically AppleScript in JS) in macOS and win32com in Windows.
pip install docx2pdf
docx2pdf myfolder/
Disclaimer: I wrote this tool after struggling to find a cross-platform solution for batch converting docx to pdf with zero formatting issues since it directly uses Microsoft Word. https://github.com/AlJohri/docx2pdf
Provided you have MS Word (or any other app that can open MS Word files) installed, you can use Automator. Here is a step by step guide on how to set it up for your needs: http://aseriesoftubes.com/articles/how-to-batch-convert-doc-files-to-pdf-format-using-mac-osx-automator/
Brief overview of the whole process:
- Open Automator
- Create a new workflow
- From the
library
panel on the left, selectFiles & Folders
then double-clickGet Specified Finder Items
- Add the all the files to convert
- From the
library
panel, now selectDocuments
, then double clickConvert Format of Word Documents
- From the dropdown menu, select
Portable Document Format (PDF)
- Finally, click the
Run
button, and it will convert all the files and save them in the same folder where the original Word files are.