Skip to Content

Ask TUAW Video Edition: PDF and Scripting

ask tuaw videoAndrew asked us about how to have a folder convert documents to PDF format so that he can sync them to his Dropbox.

Today's show goes into how to use Automator and AppleScript to do some scripting, and we're going to demonstrate an iPad app that will convert documents for you on your iPad.

Some resources for you:

Any questions, please leave them in the comments or email us! Read on for the video.



Categories

Ask TUAW

Andrew asked us about how to have a folder convert documents to PDF format so that he can sync them to his Dropbox. Today's show goes...
 

Add a Comment

*0 / 3000 Character Maximum Comment Moderation Enabled. Your comment will appear after it is cleared by an editor.

11 Comments

Filter by:
uzerzero

If you're into shell scripting and the Unix sublayer of OS X, you could try using Doc2pdf or any of the other myriad of command line tools.

Personally, I use Quickoffice to view Word docs downloaded from the Internet and just use Word's save as PDF or print to PDF for conversion. Roundabout way and not good for multiple files, but I don't do it often, only when using the school's printer that only supports PDF via USB storage.

March 29 2011 at 4:32 PM Report abuse rate up rate down Reply
1 reply to uzerzero's comment
Justin Esgar

JHam - isn't Doc2PDF a web service? Is there a way to run it local on a specific folder?

Thanks
Justin

March 30 2011 at 3:46 AM Report abuse rate up rate down Reply
Andrew


How supremely disappointing. I was excited by the title but, as others have mentioned, Automator's "Convert Format of Word Documents" doesn't work when saving to PDF. Unless I've missed something (other than the past hour of my life searching Google) this doesn't work.

Thanks for the idea anyway, Justin--did this work for you?

March 29 2011 at 4:25 PM Report abuse rate up rate down Reply
1 reply to Andrew's comment
Justin Esgar

Andrew - I was able to make it work with Applescript, I was just showing the Automator piece as an example. I believe that Applescript is not as "scary" as some people make it out to be. I'm sure if you google something like "Applescript, PDF convert" there are plenty of examples out there that will work for you.

Thanks
Justin

March 30 2011 at 3:45 AM Report abuse rate up rate down Reply
cycladic

Tom, I used the Convert Word to PDF function in Automator with good results. (I did have to use the option to locate my initial Word files, which were already in my selected folder, in order to test my workflow within Automator.) All the files were readable PDFs and, sure enough, new Word documents added to that folder are converted to PDFs.

I'm really grateful for this tip as it will save me a significant amount of time when I receive 40 student Word documents which I then convert to PDFs for grading and for my course records. I just wish I would take the time to set up other scripting workflows. (I do use the scripting functions in Adobe Bridge to convert and process image files.)

March 29 2011 at 3:06 PM Report abuse rate up rate down Reply
Dorje

Having done my share if automator and apple script hackery I've actually found using the accessibility layer of OSX can sometimes be easier to understand. For my scripting needs I found UI Browser by PreFab http://pfiddlesoft.com/uibrowser/ to be indispensable. As long as the App uses resources accessibility understands you can script it.

What I'd do is make an Apple Script that invokes the Print command and then the "Save as PDF" function in OSX itself. That Apple Script can be placed in automator with variables for file name and saving location passed into the Apple Script. Granted that ties up the UI while it runs, although on the plus side it's a bit easier to understand how the OS is doing what you want it to.

Something like :
activate application "Firefox"
tell application "System Events"
tell process "Firefix"
click menu item "Print..." of menu 1 of menu bar item "File" of menu bar 1
delay 1
click menu button "PDF of window "Print"
try
tell menu item 1 of menu 1 of menu button "PDF of window "Print"
set {xPosition, yPosition} to position
set {xSize, ySize} to size end tell
end tell
click at {xPosition + (xSize div 2), yPosition + (ySize div 2)}
end try
end tell
end tell

You can add more to that by calling fields in the "Save" window such as "Save As:" and "Where:" but I'm going to stop there. Replace Firefox with a variable that stores the current running App and it should be valid for just about any Cocoa App.

No offense to Automator as I use it enough, but Apple has really let it degrade in a shameful way. At least Apple Script stays current with system commands if you know how to invoke them.

March 29 2011 at 1:07 PM Report abuse rate up rate down Reply
1 reply to Dorje's comment
Justin Esgar

Droje - nice script. Glad you were able to share it with us.

Applescript obviously has it's benefits over Automator - but some people are so scared of it!

Again thanks for sharing
Justin

March 30 2011 at 3:43 AM Report abuse rate up rate down Reply
Tom

I tried this using the automator method however preview won't allow me to open the PDF at the end. It says 'The file cannot be opened...It may be damaged or use a file format that Preview doesn’t recognize.'

Anybody got any ideas what might be going on with this?

March 29 2011 at 10:44 AM Report abuse rate up rate down Reply
3 replies to Tom's comment
Buy an ad here

Tweets

© 2012 AOL Inc. All Rights Reserved.