PDF Compatibility in SharePoint 2010


Out of the box SharePoint 2010 does not make it easy to store and work with PDF files. When you save a PDF to a SharePoint 2010 library there are four things you will notice right away.

  1. There is no PDF icon
  2. Opening a PDF results in a Save dialog box (see below) instead of opening in the browser or client
  3. PDF files cannot be edited without saving locally first
  4. PDF files are not supported in Search (Future Post)

This is going to get on your users nerves and it really detracts from all the cool things SharePoint 2010 can do. There are many posts out there giving advice as to what to do to resolve these issues. Most don’t address it properly, however. If you see any recommendations telling you to set your Web Application from Strict to Permissive then you need to disregard that advice. In a nutshell, setting the Web Application to Permissive allows any file type to be opened in SharePoint 2010 which can leave your network at risk.  So DON”T DO THAT!

We’ll first go over the process for getting the PDF icon to appear.

Add PDF Icon

Note: These instructions apply to any program file you want to add, not just for PDF’s

These steps are to be performed on all of your Web Front End Servers (WFE).

  • Download the Adobe PDF icon (Click Here)
  • Save the downloaded file as: ICPDF.gif
  • Copy the ICPDF.gif file to the following location

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES

  • Navigate to the following location
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML
  • Edit the DOCICON.XML file
  • Add the following line of code in the <ByExtension> section. (Preferrably you will put this in alphabetical order by the extension)
<Mapping Key=”pdf” value=”icpdf.gif” EditText=”Adobe Acrobat” OpenControl=”AdobeAcrobat.OpenDocuments”/>
  • Save the DOCICON.XML file
  • Perform an IISRESET on all WFE’s (note this will result in a short outage)

You should now see the PDF Icon Adobe PDF icon appear next to all PDF files stored in your SharePoint 2010 libraries and if you have Adobe Reader X you will be prompted if you would like to check out the file and open and then will open in your Adobe client software.

NOTE: This will address the ability to open and edit a PDF in your Adobe software as long as you have Adobe Reader X installed. Otherwise this will not work as expected.

Add PDF to Allowed Mime Types

Now we need to address the ability to open a PDF from the browser. This is predominantly important for environments that do not have Adobe Reader X installed.

I have a PowerShell Script you can run which should allow you to easily add PDF to the allowed Mime Types list.

NOTE: You will need to run this script on each Web Application

NOTE: If you don’t want PDF’s to open in the browser, do not run this script

  • Copy the below code into a PowerShell script file (.ps1) I named mine Add_AllowedInlineDownloadedMimeType.ps1
$inpWebApp = Read-Host "Enter the Web Application URL to modify"
$inpExt = Read-Host "Enter the Type and Extension to test and update. (eg application/pdf)"

$webApp = Get-SPWebApplication $inpWebApp
If ($webApp.AllowedInlineDownloadedMimeTypes -notcontains $inpExt)
{
 Write-Host -ForegroundColor White "Adding MIME Type... "$inpExt
 $webApp.AllowedInlineDownloadedMimeTypes.Add($inpExt)
 $webApp.Update()
 Write-Host -ForegroundColor White "Added and saved."
} Else {
 Write-Host -ForegroundColor White $inpExt" MIME type is already added."
}
  • Execute the ps1 file you just created in
  • Type R and press enter

  • Now enter the URL of the Web Application you want to add PDF to. Press Enter

  • Now Enter the Type and Extension (for PDF this will be application/PDF). Press Enter

  • You should see the following results

  • Repeat these steps for all Web Applications
  • Test to see if you can click on and open a PDF now without receiving the Save dialog
  • The PDF file should open in the browser

Stay tuned for the Adobe PDF Search modification that will allow you to search for PDF files specifically.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s