Skip Ribbon Commands Skip to main content
Help (new window)
Sign In
Navigate Up

PDF Icon

 
SharePoint 2010 doesn't have the PDF Icon out of the box.  It's simple to add it on the web server for on-premises installations. 
However MS has yet to do so for Office365. SO if you're tired of waiting then you can replace the generic icon using javascript like so:
 
{UPDATE} 2011.09.30:  I'VE COMPLETED A SIMPLER AND MORE COMPLETE SOLUTION HERE:
I SUGGEST YOU IMPLEMENT THE ABOVE SOLUTION RATHER THAN THE ONE ON THIS PAGE.
 
Get files on your environment:
 
1) Download these:

2) Upload those files to your Site Assets Library:

https://<yoursite>/siteassets

 

Replace the icons on your Document Library Views:

 

1)  Add Content Editor Web Part at the bottom

2) Edit the CEWP and reference the JavaScript file in the source

'/siteassets/pdficon.js'

3) Save and refresh the page and you'll see the icons like this:
 
PDFIconDocs.PNG

Add the Content Editor Web Part to all your Doc Lib Views.  This could be a lot of work, so it's probably possible to add this script to your master page instead, but I haven't tried that yet.  You can hide the CEWP if you don't want to see it.
 
Explanation:
The List View Web part outputs the following HTML (new lines & indents added for clarity):
 
PDFIconDocSource.png
The JavaScript simply loops through all the <td> elements finding those with the class 'ms-vb-icon'.
Then it gets the title attribute of the <img> tag within the <td> and checks for a pdf file extension
If it's a pdf then the src attribute is changed from the generic icon to the icpdf.gif
 
Here is the JavaScript of the PDFIcon.js  I'm no pro so I won't be impressed if you can do it on fewer lines ;-)

I'll try to add this to my PDF Site Template soon.

 

 Content Editor ‭[1]‬