Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use AppleScript to capture PDF screenshots in 10.4 System 10.4
Apple decided to change the default file format of screen captures from PDF to PNG in OS X 10.4.x. In so doing, they also did not take the time to make a preference setting so users can pick their own preferred format of working with images. This workaround uses two scripts to bring back the default PDF format for output using the Scripts menu, leaving the standard keyboard shortcuts generating files in PNG format.

Note: Users of previous versions of Mac OS X who would like to have PNG output instead of their native PDF output can simply modify the line set format_ to "pdf" to read set format_ to "png" in each of the below scripts. There you go, two hints for the price of one!

First, create the scripts. Open Script Editor from /Applications/AppleScript, and first paste in the Screen Capture PDF script. This script will do a full-screen capture to PDF. Save the file with the name _Screen Capture PDF and save it in /Library/Scripts (depending on your account's permissions, you may have to first save it to the Desktop, then move it to this folder manually). Set the Format to Application, and check the Run Only box (leave the other two options unchecked).

Next, create a new empty script, and paste in the Selection Capture PDF script. Save this one as _Selection Capture PDF, also in /Library/Scripts, with Format set to Application and Run Only checked.

If you haven't done so already, enable the Scripts menu. Run the AppleScript Utility application in /Applications/AppleScript. At the bottom is a check box next to Show Script Menu in menu bar -- make sure this is checked! Below that is a check box next to Show Library scripts; make sure this is also checked. Below that are two radio buttons/circles, in which I have "Bottom" selected. Close the AppleScript Utility

The tools are now ready to use. On the top right of your Mac's menubar will be the black scripts icon (it looks like a curled sheet of paper). Select that, and near the top will be the two scripts. If you want to take a shot of the entire screen, use _Screen Capture PDF. If you want to only take a snapshot of a part of the screen, use _Selection Capture PDF, and then use your mouse to draw a box with the mouse button (left mouse button on non-Apple mice).

[robg adds: I tested these and they both work. If you have more than one screen and would like them all captured, change ...screencapture -mt"... to ...screencapture -t"... in the first script. You could also modify the file type from PDF to something else, though the screensaver documentation doesn't define the syntax for any of the types. This hint is *not* marked Tiger-only, as these scripts will work in 10.3, as noted above.]
  • Currently 3.75 / 5
  You rated: 4 / 5 (4 votes cast)

Use AppleScript to capture PDF screenshots in 10.4 | 6 comments | Create New Account
Click here to return to the 'Use AppleScript to capture PDF screenshots in 10.4' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use AppleScript to capture PDF screenshots in 10.4
Authored by: digiglyphics on Jun 14, '05 11:41:25AM

THANK YOU! I was not happy about the PNG format. It just created more work (conversion) for my purposes. PDF's and TIFF's were both useful, I've never had a reason to use a PNG. Thanks Apple!


[ Reply to This | # ]
Use AppleScript to capture PDF screenshots in 10.4
Authored by: webgodjj on Jun 14, '05 12:28:23PM

I was wondering about this. So it is a script now, does this mean that there are no settings available without sending shell commands? ie.. a .plist or something simular?


[ Reply to This | # ]
Use AppleScript to capture PDF screenshots in 10.4
Authored by: afb on Jun 14, '05 03:46:07PM

What's wrong with PNG? It's lossless and reasonably small. I for one am glad that Apple changed the screenshot format from PDF.

[ Reply to This | # ]
Use AppleScript to capture PDF screenshots in 10.4
Authored by: gurman on Jun 15, '05 03:12:13PM
What's wrong with PNG? It doesn't scale up well.

What's wrong with changing default behavior, without documenting it or explaining to the user in Help or man pages how to change it?

FWIW, I reported this as a bug to Apple, and got the expected reply; that is, that it's working as expected. They were kind enough, however, to give the new, 10.4.x-compatible syntax for changing the file format default for screencapture:

defaults write type pdf

If you prefer jpg, or whatever, you can replace "pdf" with that, and switch back to "png" if you like.

[ Reply to This | # ]

Re: Use AppleScript to capture PDF screenshots in 10.4
Authored by: Uncle Asad on Jun 16, '05 02:56:31AM

These *don't* actually seem to work in 10.3.x, unless I'm missing something huge here. Did robg test the 10.3 claims?

screencapture does not support -t or any format options under 10.3.9 (plus the alert/dialog syntax is different, but that's easily fixed...).

Wish it were so, though, as it would have saved a trip through Grab or Preview and GraphicConverter to convert screenshots.... :-(

[ Reply to This | # ]
Re: Use AppleScript to capture PDF screenshots in 10.4
Authored by: llee on Jul 03, '05 08:44:18PM

Correct, you can't make them work in 10.3 simply by changing the "set format_" line. What's more, although I haven't tested in 10.4, I don't see how it could work as is there either, because in the versions of the scripts that are linked as of this posting, there is no space between the "-mit" and the "format_" variable, so the Applescript constructed shell command actually begins with "/usr/sbin/screencapture -mitpfd". Could that work?

But, more importantly for me, is there indeed a Panther defaults write command that results in changing the default screen capture format that corresponds to the Tiger compatible "defaults write type pdf"?

I would certainly rather have that. Thanks.

[ Reply to This | # ]