Opening PDF files in SharePoint 2010

One problem you may be facing if you are new to SharePoint 2010 is how to open PDF files.  There are a couple different problems you may have noticed.  One: the PDF files do not show a file type icon like the Word or Excel files do, and Two: when you click on a PDF file to open it, you are presented with a dialog box asking you to Save or Cancel.

By default, SharePoint does not recognize PDF files, so we will have to tell it how to recognize the files to display the pretty icon.

The reason the PDF does not open is because of a new header called X-Download-Options that is passed into your browser and if you are using IE 8, a new security feature will block the file from opening.

While we are setting up PDF files, lets go ahead and configure SharePoint’s search engine so that it can crawl the contents of PDF files as well.

Opening PDFs

First, let’s tackle the easiest to fix issue.  A SharePoint web application has two modes that it uses to handle browser files: Permissive and Strict.  The default mode is Strict and will cause SharePoint to send the X-Download-Options header.

To turn off the header:

  • Open your SharePoint Central Administration.
  • Click on “Manage web applications.”
  • Click on “SharePoint – 80.”
  • In the ribbon at the top of the page, click “General Settings.”
  • Scroll down the pop up window until you find “Browser file handling” and change the selected value from “Strict” to “Permissive.”
  • Click OK to save changes.

Setting Up The Search Engine To Crawl PDFs

Showing the PDF Icon

  • Visit Adobe’s site to download an image of their PDF icon.  Save a copy of the 17 x 17 image size to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES\ on your SharePoint server.
  • Edit the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML\DOCICON.XML file on your SharePoint server.
  • Scroll down to the <ByExtension> tag and enter the following between the <ByExtension> and </ByExtension> tags:
    <Mapping Key=”pdf” Value=”pdficon_small.gif” OpenControl=”” />
    * If you want to keep the file organized, check the other keys and enter it in alphabetical order.
  • Save the XML file.
  • Next, open the SharePoint Central Administration site.
  • Under “Application Management”, click “Manage service applications.”
  • Scroll down the list of applications and click on “Search service application.”
  • In the left-hand menu, click “File types.”
  • Click “New file type.”
  • Enter “pdf” into the “File extension” box and click OK.
  • Now, you should be able to scroll down and find your PDF icon.

Now, we’ll need to restart IIS by opening the command prompt on your SharePoint server as Administrator.  Type into the command prompt: “iisreset” and IIS will be stopped and restarted.

Running A Full Crawl

  • From the Central Administration, under “Application Management”, click on “Manage service applications.”
  • Scroll down and click on “Search service application.”
  • From the left-hand menu, click “Content Sources.”
  • Hover your mouse over the “Local SharePoint sites” record and click the down arrow for more options.
  • Select “Start full crawl”

Now, you should be able to open PDF files, see adobe icons next to them in library web parts, and be able to search the contents using SharePoint’s search engine.

You may also like...

6 Responses

  1. Phil says:

    Awesome!! Thank you very much.

  2. Dmitry says:

    Hi:

    Re: Opening PDF documents

    There is a better way to handle “Browser File Handle” issue. Take a look at my blog here: http://www.pdfsharepoint.com/sharepoint-2010-and-pdf-integration-series-part-1/

    Solution #2 addresses Pdf extension without exposing entire Web Application to “Permissive” browsing. Setting “Browsing File Handle” to “permissive” opens too many vulnerabilities with other file extensions.

    Thanks,

    Dmitry

  3. @Dmitry
    Thanks for the additional information. I agree, setting the option to “permissive” is not the ideal solution, although for my purpose (using SharePoint as an Intranet solution), it doesn’t worry me as much as if I were using it for a public facing site.

  4. Jovi says:

    nice post!! Thank you!

  5. arun says:

    still not able to search pdf files..
    plz tell me
    whether i need to chge Default content access account or anything else..??

  6. @arun
    Sorry to hear it. When I wrote up this tutorial, I was careful to write down step by step what I had done to get this working.

    This is a free approach to this problem. There are also filters you can purchase that are suppose to be faster and should provide support.

    SharePoint is a very large product with many moving parts, so sorry I don’t have a better answer for you.

Leave a Reply

Your email address will not be published. Required fields are marked *