Friday, September 10, 2010

SharePoint 2010 - Open PDF files in browser and set file association icon

Those who have experience with SharePoint 2010 may have noticed that pdf files in SharePoint 2010 do not open in browser by default. SharePoint 2010 throws a prompt to save the pdf file.

This is by behaviour in SharePoint 2010 and is very annoying especially when you have a requirement to show a pdf file in a Page Viewer Web Part, etc...

Luckily there is a workaround to fix this issue.

Open Central Admin > Application Management > Manage Web Applications.
Choose a web application and click "General Settings".


Scroll towards the bottom of the page until you find the section "Browser File Handling".
Change the option from "Strict" to "Permissive".


Go back to the document library and click on the pdf file. It should open in the browser. (Perform an IISRESET if required.)

You may also have noticed that the icons for pdf files do not show up by default in SharePoint 2010.

In order to fix it, we will need to set up document icon associations to inform SharePoint 2010 about the extension "pdf"

Navigate to 14 hive (“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14”) and then to TEMPLATE\IMAGES. Upload the desired file icon (pdf in this case. You can use this icon for pdf)


Navigate to 14 hive, then to TEMPLATE\XML folder.
Locate the file "DOCICON.XML" and open it with a compatible editor.


Add the below line of text as required for the file extension (PDF mapping in this case):
<Mapping Key="pdf" Value="icpdf.png"/>


Perform an IISRESET and refresh the document library.
You should now see pdf icon next to the pdf documents.


 Hope that this post helps someone.

No comments:

Post a Comment