Add PDF icon definitions to Safari

Feb 14, '03 12:36:37AM

Contributed by: zeb

I recently read this hint which explains how to get Safari to recognize PDF files stored on your local drive. I now use Safari as my default PDF viewer, however if you set a PDF to open with Safari by default, the PDF icon will be the generic document icon because Safari doesn't include an icon for PDFs. Here's how to get a nice icon instead...

First you need to make a nice icon. Control-click on Safari and select "Show Package Contents". In the Resources folder you will find "document.icns" which is the icon file used for HTML documents. Duplicate this file and call it something like "pdfDocument.icns", open it in an icon editor like Iconographer and add the text "PDF" to it (or get as creative as you like). Alternatively, you could simply copy an existing PDF icon file to the Resources folder. Whatever you do, just make sure your new icon file is in the Resources folder. Now that you have the icon file, all you have to do is tell Safari to use it. Open the "info.plist" document (in the Contents folder) and find the PDF document type key you added (described in the hint referenced above). Within this key is the key which defines the PDF extensions:

<key>CFBundleTypeExtensions</key>
<array>
<string>pdf</string>
<string>PDF</string>
</array>
Place the following just below it:
<key>CFBundleTypeIconFile</key>
<string>pdfDocument.icns</string>
Just make sure that the name between the "string" tags matches the name of your PDF icon file. Now when you change a PDF to open with Safari, it should use the icon file you specified. I think you might need to log out for the changes to be recognized by the system.

Comments (4)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030213213637974