- Dear Viewers Using IE6
- Personal and Professional Resolutions for 2009
- Latest from the Kitchen Renos
- 2008 in Review
- 16 ways to know you are addicted to Twitter
- I ARE SERIOUS CAT stars in The IT Crowd
- My Relative from 18th Century: George Hodge
- Hoge’s of Duns, Scotland. Near Blackadder
- 12 O’Clock High Trivia
- This Holiday’s TV Obsession
- OH, HELO HOLLYDAIS!
- Publicis Mojo accidental Spammer for Metamucil
- Follow the Code: Microsoft and Open
- Understanding Thailand Politics
- Ray Ozzie: by Steven Levy
- Kitchen Installed
- A Hole in the Wall
- Bathroom: Ready for Rendering
- Private Angus Hodge
- Hodge Family History Update
Moonshine: Distilling PDF into JPEG using Scripting
By Nick Hodge | June 16, 2003
Distilling PDF into JPEG Photoshop 7.0's scripting
Problem from a customer: they create many, many PDFs for both client sign off and delivery as final form documents. However, they need a mechanism of permitting their clients to "preview" the PDFs online before downloading for signoff.
So, out with the newest Adobe application on the block: Photoshop 7.0. Photoshop 7.0 has a major new addition: Scriptability. Using AppleScript on MacOS, VB (COM) scripting on Windows and Javascript on both platforms, you can write scripts that interact with Photoshop and other applications. For scripters, this is the holy grail. From my first days at Adobe, one of the gurus of AppleScripting Shane Stanley, hounded me about Photoshop scriptability. In Photoshop 7.0, we've finally delivered.
This script is quite simple: once launched, it watches one directory for PDFs. Once one arrives, it askes Photoshop to open and rasterise it. After converting it to RGB, it resizes to a particular width, then saves a JPEG into an out directory. The PDF is moved to a done directory. They are not deleted.
The first thing you need to do with the file moonshine source script is customise the paths the script "looks at" in its processing. The target image width also needs to be set.
After editing these four properties, you will need to save the script as an application and to stay open. This script has an "idle" handler: essentially it periodically checks that in directory for new PDFs to work on.
You will need the AppleScript plugin for Photoshop 7.0: Photoshop 7.0 Scripting Plugin 1.0.2a (Mac)
And my script which is here:
MacOS X 10.2.6: Moonshine for MacOS X 10.2.6
MacOS X: Moonshine for MacOS X
MacOS 9: Moonshine for MacOS9
Why as specific MacOS X script? This script uses the Finder's file extension property of a file to determine if a particular file is a PDF. This doesn't seem to be implemented in MacOS 9.2.2's Finder scripting dictionary. This is easy to replace with a string comparison of the file name. Why a MacOS X 10.2.6 Script? Apple, in their infinite wisdom, slightly changed the scripting dictionary in the Finder at some stage and this has resulted in a minor script change. Thanks William for the heads-up.
Topics: mungenet |





Comments