I've been trying to find a way to make an Automator workflow that will take the name of a folder and combine it's files into a PDF with as little manual input as possible and have finally figured out how to do so. I've seen others ask how to do this for a while so I wanted to share how I did it.
Why would you want to create PDFs? If you have scanned books, photos, documents or anything else on your Mac, you can create PDFs out of them. You can then store these in iTunes and either read them using Preview on your Mac or iBooks on your iOS device.
What this workflow will do:
Create/have a backup of your files!
Create a folder somewhere that you can drop your folders in. Name it Automator Dropbox. You can create one wherever you want, but this workflow was created with Automator Dropbox in mind so you'll need to change it as necessary.
Open Automator and create a new workflow.
Find Finder Items
- Search Automator Dropbox
- [All] of the following are true:
- [Label] is [Red]
This will search for any folders that were done before.
Move Finder Items to Trash
This will move the previous folder/files to the trash.
Ask for Finder Items
- Prompt: [Choose a Folder]
- Start at: Automator Dropbox
- Type: [Folders]
This will ask you to choose the next item to convert to PDF.
Set Value of Variable
- Variable: pdfvariable
This will take the name of the folder you just selected and use it to to rename your PDF.
Label Finder Items
This will mark the folder you're working on for deletion the next time the workflow is ran.
Get Folder Contents
This will grab all the image files within the folder so that it can create a PDF out of them.
- To size (pixels): 1600
This will scale the maximum dimension of your image down (or up) to 1600px. I find this to be the sweet spot for performance on the iPad 3, and it looks just fine. If the maximum dimension of your image is lower than 1600px, I'd create a duplicate workflow of this and leave out this step; otherwise you will be upscaling and your image won't look as good. You can also leave this step out if you want your original image size kept, but on the iPad 3 and below there will be a delay going from page to page.
New PDF From Images
- Save Output to: [Desktop]
- Output File Name: tempname
This will save your finalized PDF to the Desktop. You can change this to whatever you want; I would suggest the Automatically Add to iTunes folder located in [Music > iTunes > iTunes Media > Automatically Add to iTunes]. You will find your PDF in the Books category in iTunes.
Rename Finder Items
- [Replace Text]
- Find: tempname in [Full Name]. Ignore Case checked.
- Replace: [pdfvariable] (Drag pdfvariable from the variables window into the text field for "Replace". If you don't see the variables, go to "View > Variables."
You can't just drag the variable into the PDF name field in the step above, so this extra step is necessary. It will rename your PDF with the name of the folder it was created from. It will also add the full file path, which will be taken care of in the next step.
Rename Finder Items
- [Replace Text]
- Find: Users/yourname/Documents/Automator Dropbox in [Full Name]. Ignore Case checked.
- Replace: LEAVE EMPTY
This will delete the name of the path from the name of your PDF. If your working folder is not Documents/Automator Dropbox, change it to whatever that is.
If you're running this workflow on a bunch of folders, you can simply keep your cursor over the workflow's play button and press the right arrow + enter to select the next item in queue. This workflow was made for using a little human interaction as possible, so if anyone has suggestions on how to improve on it please post below.
One last thing - if you're seeing a red folder when you run the workflow to choose a folder, it's because spotlight hasn't indexed it yet and the workflow could not find it to delete it. Just go on to the next item.