Today I have spent a significant time preparing my lecture notes for my subjects. The subject that I am preparing has a large number of PowerPoint files that need to be printed as PDF. I wanted to print all of the PowerPoint files to double sided PDFs. Rather than doing this manually I wanted to create a script to automate the process.
Opening the Files: the first part of my process involved creating a script to automate the process of opening the PDF files. I organise my documents in folders, so all of the documents that I wanted to print are located in a tree under a single directory.
The Automator workflow to open the PowerPoint files is actually very simple (shown here). I attached three finder actions. The first is the Get Folder Contents action. This action is used to process all of the items within the selected folder. Select the Repeat for each subfolder found, so that all of the subfolders are processed.
Following this action is the Filter Finder Items action. I use this action to filter the items to those that end with "Handout.ppt" as this is the ending to all of the presentations that I want to open. The last action in the workflow is the Open Finder items action. This action will open all of the items that are passed to it from the previous actions.
Printing the Presentations: The next step should have been simple... but it isn't. I started approaching this by creating a Applescript that printed via PDF. Getting the Print dialog to appear was simple, and examples all over the web illustrate how to click that PDF button, but none of them worked for me. I ended up using the UI element explorer and finding that the path to this menu is not easily achieved. In fact the explorer had issues highlighting it... If anyone knows how to get this working please let me know.
My next approach was to find a PDF printer... yes I know you can save as a PDF, but not with a script as far as I can tell. This was actually much easier than I first thought. Following the discussion on this forum. The best description is on the second page. Using this and some simple VBA script (basically for each presentation, print out the presentation) I can now print all of the open presnetations using the selected printer. Using the new PDF printer allows me to print these to PDF.
Next I wanted to have the PDFs printed two per page. Adjusting the print settings and printing via the script did not work. I started looking around and found some useful postscript editing utilities... So I had gone to all that effort to get the PDF printer and what I really wanted was a postscript printer. I created a modified version of the PDF script that copied the passed in postscript to a file, allowing me to use the existing scripts. Using this I was able to create postscript files of the notes for all of the presentation.
Scripting PS manipulation: To get the postscript modifying programs download Fink. This installer allows you to download common Unix utilities compiled to run on Mac OS X. Install the ghostscript, gv, and psutils-a4 package (for the A4 version). From the command line run the following instructions...
find . -type f -path "*.ps" -exec psnup -b0 -m0 -l -pa4 -2 {} "{}.ps"
find . -type f -path "*.ps.ps" -exec ps2pdfwr -sPAPERSIZE=a4 {}
This will create some strangely named file (a.ps becomes a.ps.ps and then a.ps.pdf), however the script will create the files as two per page PDF. The script also allows you to quickly process large numbers of presentations at once. With a little more work I am sure that I can create a better script, but this one has worked fine for the moment.
Wednesday, February 07, 2007
Presentation to PDF
Subscribe to:
Post Comments (Atom)
2 comments:
Wow, I would have just used Acrobat Professional...
I have Acrobat, and could have done this by hand... but automating the process will make this easier for me next time around.
Post a Comment