15 May

Using Automator to convert Pages to PDF

Recently we were asked how to use Automator to convert Apple Pages documents into PDFs. In the spirit of sharing the knowledge, here’s how we did it.

It’d be great to make an app which we could drop our Pages files on and have them made into PDFs. The obvious way to make such an app is with Automator. Unfortunately, Pages doesn’t ship with Automator actions (although there are some funky third party options)

Luckily, Pages is AppleScriptable so we can make our own action. Let’s look at how to do that.

First, launch Automator (you’ll find it in your Mac’s Applications folder). Select “Application”.

Screen Shot 2016-05-12 at 13.19.38

Next, drag a “Run AppleScript” workflow into your workflow so you have something that looks like this:

Screen Shot 2016-05-12 at 13.20.06

Replace all the purple text in the action with the following AppleScript:

on run {input, parameters}

repeat with theFile in input
tell application "Finder"
set theFilesFolder to (folder of theFile) as text
end tell

tell application "Pages"
set theDoc to open theFile

set theDocName to name of theDoc
set theName to (characters 1 thru -7 of theDocName) as text
export theDoc as PDF to file ((theFilesFolder & theName & ".pdf") as text)

close theDoc

end tell
end repeat
return input
end run

Save the workflow and you should now have an app that you can drop Pages documents on.

Note that it’s up to you to make sure that the documents you drop actually are Pages documents – the script doesn’t check and may error if you drop the wrong type of documents.

On a related note, if you’d rather dodge the AppleScripting all together then you could try out our handy Pages Automator Actions.

While we have your attention… why not check out our macOS apps?

Barcode Basics – macOS barcode generator (including Automator support)
Ai Actions – Automator action pack for Adobe Illustrator
Pages Automator Actions – Automator action pack for Pages