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.

Automating Billing with TextExpander and Automator

In my day job, we use an antiquated old Windows PC system for managing our billing. It takes multiple mouse clicks and butten presses to make a simple entry. It almost feels like I have to walk across the office and turn a wheel somewhere to make a billing entry. Several years ago I decided I was done with it.

Instead, I started making my billing entries in a Byword file called, unsuprisingingly, billings. I keep this file open as I go through my day and make entries with a series of cryptic TextExpander snippets.

For example:

xrvc

expands to

## Roadrunner v. Coyote

and

xtto

gets me

Place telephone call to opposing counsel concerning

Using these snippets it is really easy to capture billing entries as I move through my day. The Billings file syncs through iCloud to my iPhone and and iPad and I use TextExpander touch on those devices too (syncing through Dropbox) so billing entries are no more difficult there.

Another snippet I use every morning is

xbill

Which renders the date and summary information.

#2013-04-10 Billings

Totals

B

NC

Admin

CD

At the end of the day, I email the text file off to one of the staff members so she can click buttons, turn dials, and feed coal into our billing system.

About the hundredth time after I copied the text, went and started a new email and then pasted it in, I realized that there must be an easier way to automate this. Of course there is. I use Automator to create and send an email to my assistant every day with my billing text. Here's the Automator service workflow.

The workflow takes the selected text and then prepares an email. It then copies the selected text in the body of the email and uses the recipient and subject line I specify. Then it automatically sends the email. Except for selecting the text and firing off the service, I have no interaction whatsoever. (I should probably attach a keyboard shortcut to make this feel even more magical.)

This is the first automation service I've created that sends off an email without me even looking at it and at first it was a little weird but now I've gotten over it and I love that my Mac does it all for me.