Automator workflow of the month: Powerful PDF tricks
PDF is a wonderful format for reading documents, but once you move beyond reading, things can get complicated in a hurry. Thankfully, useful tools for working with PDF files are built into Automator, OS X's built-in workflow tool. Let’s run through a few of them now.
Combine PDF documents
Sometimes you may have multiple PDF files that would be more conveniently viewed as a single document—three files related to the same project, for example. Preview allows you to combine PDF files by opening the first one, choosing View > Thumbnails, and then dragging another PDF into the thumbnails pane. But such manual dragging can be a hassle, particularly when you’re working with many files. Automator lets you do it in a single step.
Launch Automator, pick Application from the workflow chooser that appears, and click Choose. Select PDFs from the Library pane. From the Actions pane drag the Combine PDF Pages action into the workflow area. Be sure that Appending Pages is enabled in this action. Now choose Files & Folders from the Library pane and drag the Move Finder Items action into the workflow, below the first action. Select a destination for the combined PDF file that the workflow will create (the Desktop or Documents folder, for example). Save the workflow as an application and place it on the desktop.
When you wish to combine PDF files, just select them and drag them on top of the workflow. In a short while they’ll be combined into a new PDF file, and that file will appear where you asked Automator to place it.
Note that the documents will appear in alphabetical order within the resulting PDF file. If you care about their arrangement, number them in the order you wish them to appear—1 Marketing Strategy, 2 Sales Actions, 3 Projected Results, for example.
Extract PDF text
No one would argue that PDF is a good format for editing text. And because it isn’t, you'll sometimes want to copy the text from a PDF file, paste it into a text editor or word processing application, and have your way with it. Automator can help here as well.
Create an application workflow, select PDFs in the Library pane, and drag the Extract PDF Text action to the workflow area. Configure the action in the way you prefer—choose to output your text as plain or rich text, add a page header or footer, and choose a name for the output file.
And that’s it. Save the workflow to your desktop and drag a PDF to it to extract the document’s text to a TextEdit file. Be aware that the resulting copied text may be jumbled if the document contains text blocks and columns. Those blocks won’t be interpreted as individual elements but rather wrapped up as part of the text that precedes or follows it.
As you’re likely aware, you can annotate PDF files in Preview by choosing Tools > Annotate and then selecting the kind of annotation tool you’d like to use. Helpful as those appended bits of text and highlights are, having them in a separate text document may at times be useful—for example, when you wish to use them as footnotes in a scholarly paper or business report. Automator allows you to do this easily.
Create yet another application workflow. Select PDFs in the Library pane, and then drag the Extract PDF Annotations action to the workflow area. Now choose Text in the Library pane and drag in the New TextEdit Document action. In the Extract PDF Annotations action, enable the kinds of annotations that you’d like to extract to your text document—your choices are Text, Free Text, and Highlight. You can additionally configure the fields to extract—Page Label, User Name, Modification Date, and Contents.
Save and name your workflow and place it on the desktop. When you next wish to extract annotations from a PDF file, just drag it on top of the workflow. TextEdit will launch and create a new document that contains the annotations from your PDF.