Automating PDF Creation from Image Files on the Mac

Recently a client sent me a contract electronically by taking a series of photos of a document. This happens to me once in a while, and usually I open the individual images in Preview, combine them, and save them as PDF. I received another such series of photos this morning and finally decided to automate this process so I don’t have to do it manually anymore. Automator to the rescue.

Why I Love Automator Services

Automator has the ability to create Services. These are little programs that reside in the contextual menu on your Mac. Right-clicking on a file gives you an option to employ Services. The nice thing about Services is that they stay out of the way until you need them, and then they are there, just a right-click away. (All screenshots in this post will get bigger on your screen if you click them.)

So I decided to make my little automation routine for combining PDF files a Service. This happens after you open the Automator App and click New in the File menu. 

In order to get to the Services menu, you’ve already selected a file. This means the Services don’t need the typical file-selection nonsense. To run the Service, you’ll first select the images you want to combine and convert to PDF. Clever, right?

Because the Service we are creating is made specifically to turn images into PDFs, we don't want our Macs to try and use it against other types of files such as text files or music files. Therefore, we will limit the Service so that it only works when it receives image files.

Now Let’s Get Automating 

If you’ve never used Automator before, don't sweat it. It's easy. Automator has a series of tools on the left side that you drag into your workflow on the right side. You stack those together like LEGO bricks and at the end you've created a program. This Automator workflow has just two bricks. The first thing we’ll need to do is take the existing images and convert them into a single PDF.

Fortunately, Automator has a tool specifically for this job named, not surprisingly, "New PDF From Images". Go in the Search bar for Automator and type "new PDF”, and the search gets you there. 

Drag the tool into the workflow area and we’re halfway there.

The Quartz Filter

We could really stop with just the one step and convert the images to PDF, but there is still a problem. Photos converted to PDF still make lousy documents. They have lots of color and are hard to read. 

MacOS has quartz filters built in that can change the way a PDF looks. There’s also an Automator tool to apply a quartz filter right in your workflow. So go ahead and search for “quartz”.

Drag the “Apply Quartz Filter to PDF Documents” tool into the workflow. When you do that, however, you’ll get the following dialog.

This dialogue is Automator being extra careful that you don’t override something you want to keep. For this workflow, I clicked “Don’t Add”.

After that, you’ll see the workflow with both steps.

You’ll note in the above screenshot that the quartz filter isn't doing anything yet. Time to change that. Click on the arrow next to the filter and select "Black & White". This converts the color image to a black-and-white image and makes the document much easier to read and edit.

That’s it. Save the script, select some images, right-click on them, and try it out from your Services menu.