Friday, June 25, 2010

Add PDF Icon to SharePoint Library

Quite obviously, we come across many occassions where PDF files are uploaded to SharePoint 2007 Libraries or Lists.

While we can easily see the images of our regular Word, Excel, PowerPoint documents, however the PDF documents look empty without the trademarked image.

Well, no problem, who says we can't have it. It is fairly simple, so let us see how:
  • Get the appropriate Adobe PDF icon image (preferrably a gif) from here 
  • Save that image confirming with SharePoint images standard such as icopdf.gif. Place the image where Office document icons exist by-default. Check out this 12 Hive path of your MOSS 2007 installation:
    Drive\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Images
  • Now that we have successfully placed the image, we need to inform SharePoint about our modification. For doing this, we need to add an entry to the DocIcon.xml file which sits in the Drive\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Xml path
  • Open the docicon.xml with any editor such as Visual Studio or even Notepad. Under ByExtension section, add a key/value pair as given below:
    Mapping Key="pdf" value="icopdf.gif"
    Note
    : Take a backup copy of the DocIcon.xml prior to the changes (to be on the safe side). Also, the XML start-end tags are removed as the post wouldnt allow it easily. Kindly take care in your case.
  • Save changes to Docicon.xml file. Perform an IISRESET command to finalize the same.
Refresh & check the same list or library page to notice the changes take effect.
Briefly, what this does has done is, if SharePoint sees any file (new/old) with an extension .pdf, it would display the PDF icon against the file as it does for Office documents.

Hope y'all find this information helpful. Cyaaa..and..stay tuned!!

1 comment:

Unknown said...

Crazy that we always have to manually do this. Wonder why MS doesn't just include this by default? Looking for a tool... someone must have automated this.

LinkWithin

Related Posts with Thumbnails