PocketModMac: MacOSX PocketMod Generator Via Print Dialog

This one goes out to all of the MacOS X users out there. (For the rest of you, why aren’t you switching?) Perhaps you have seen PocketMod — the origami-like manipulation of an 8 1/2″ by 11″ piece of paper into an 8-page booklet.

PocketMod example pictureExample PocketMod, courtesy of the Boston Globe.

Touted as a way to “get back to the basics” using analog media over digital media, it is a scheme by which you can transform pages of text into a pocket-sized form for carrying around. Many use it as a way to synchronize their digital to-do lists with the analog world, while others use it document shortcuts and cheat-sheets in a convenient form.

I’m migrating from Thinking Rock to iGTD as my Getting Things Done tool-of-choice. One of the things I’m missing about Thinking Rock is its built-in ability to create PocketMods for the actions in the GTD system. The only real easy way to create the PocketMod format was via a Flash applet or a Windows application. Some have set up shell scripts or worked with other programs, but I was looking for something as simple as the MacOS X print dialog box. And with a little bit of Automator, Java, and shell scripting, it is possible!

Step 1: Get the “Multivalent” PDF Manipulation Toolkit


The heavy lifting of this solution uses the Multivalent PDF Manipulation Toolkit. This is a Java-based application that perform various actions (impose, compress, uncompress, info, encrypt / decrypt, split and merge, and validate) on PDF documents (as well as other file formats). It is an open source application available under the GPL license (although some components of Multivalent have commercial use restrictions) available from SourceForge at this download URL: Multivalent20060102.jar. Download that file and save it somewhere on your hard drive. You’ll need to know the direct path location for the next step.

Step 2: Create the Automator Action


Launch “Automator” (you’ll find it in the Applications folder). It will start with a new, untitled work document. From the left-most panel, select “Automator”, then from the panel just to the right of that click and drag “Run Shell Script” to the empty document on the right.
Dragging "Run " to empty windows

In the ‘Run Shell Script’ action, change “Pass input” to “as arguments” then replace “cat” in the command box with this (ignoring any line breaks that may appear here — this text should be entered without line breaks):

cat "$1" > /tmp/temp$$.pdf && java -classpath [location]/Multivalent20060102.jar tool.pdf.Impose -dim 2x4 -layout "1l,2r,8l,3r,7l,4r,6l,5r" -paper letter -verbose /tmp/temp$$.pdf 2> /tmp/temp$$.err && open /tmp/temp$$-up.pdf

Replace [location] with the complete file path where you downloaded the Multivalent20060102.jar file. The final results should look something like this:
Completed action

Now save this as “PocketModMac” in either the “/Library/PDF Services” directory (to make it available to all users of your machine) or to “Library/PDF Services” in your home directory for just you.

Step 3: Using PocketModMac


Using this PocketMod generator is as simple as printing any document to any printer. In the print dialog box, pull down the PDF menu and select “PocketModMac”.
Print Dialog

After a few seconds, the Preview application will open up with the PocketMod-ed document. Print this document as you would to any printer, then follow the directions for folding and cutting the page to create your booklet.
Folding Instructions

Troubleshooting and Known Issues


Using Automator to string together a Unix command line like this is moderately fragile and doesn’t provide for a lot of feedback on potential errors. If it doesn’t work for you, one place to look for problems is in the /private/tmp directory for a file called temp[number].err. The contents of that file may give clues as to what went wrong.

This isn’t necessarily a very nice solution because it leaves files laying around in the /private/tmp directory after it is done. The /etc/periodic/daily/500.daily maintenance script will clean them out automatically after three days, but still — it is somewhat sloppy to leave them around.

The text was modified to update a link from http://www.apple.com/macosx/features/automator/ to http://support.apple.com/kb/HT2488 on December 4th, 2012.

The text was modified to update a link from http://www.apple.com/macosx/features/automator/ to http://support.apple.com/kb/HT2488 on December 4th, 2012.

The text was modified to update a link from http://www.msnbc.msn.com/id/17522664/site/newsweek/ to http://www.thedailybeast.com/newsweek/2007/03/18/the-power-of-paper.html on December 4th, 2012.

(This post was updated on 08-Jan-2013.)