Skip Navigation LinksPDF-Solution

‚Äč

 
To open PDF files in the browser from SharePoint 2010 you must allow the PDF MIME type or
 set Browser File Handing to Permissive at the Web Application level.
 
These are changes that are not available in SharePoint Online/Office365.
 
However, you can display PDF files in the browser while the above settings are strict by adding
 a simple JavaScript to embed the document.
 
Here is the HTML & JavaScript of the PDF viewer page:


 
 The code gets the  'file' query string from the URL and then builds an embed element to write the following into the page:
 
<embed id='PDF' width='100%' height='100%' src='<fileQueryString>' type='application/pdf'/>
 
If you think this is a security concern you could choose to use the google PDF viewer by replacing line 32 with the following:
 
document.write(getGView()); 
 
To make this a little easier to implement I made a couple solution templates that you can upload to your O365 and
 use to create PDF enabled sites and libraries.
 
{UPDATE} 2011.09.30:  I'VE COMPLETED A SIMPLER AND MORE COMPLETE SOLUTION HERE:
I SUGGEST YOU IMPLEMENT THE ABOVE SOLUTION RATHER THAN THIS ONE.
 
First, decide whether you're going to add this to your Public Website or your Private Team Site.
 
The solution differs depending on whether you want to display PDFs in the browser to anonymous users (public site)
 or authenticated users (private site).
 
Features for each option:
 
1) Private Team Site (PDF Site Template)
  • Install by simply creating a new Sub-Site from a Template
  • Enables Viewing PDF Files in Browser while authenticated.
  • Includes PDF Document Content Type
  • Includes PDF Document Library with Custom Hyperlinks for one-click browser viewing
  • Includes Workflow to set hyperlinks automatically upon upload of PDF file
 
2) Public Website (PDF Utilities library Template)
  • Install by simply creating a new Document Library from a Template.
  • Enables Viewing PDF Files in Browser anonymously.
  • No Automatic hyperlinks, Workflow, Content Type or Doc Library

 

 

Private Team Site Installation

Dowload this:  (PDF Site Template)

 

Then go to the site solution gallery of your team site here:
 
Upload and activate the solution like so: 

 

 
 
 
 
 
 
 
 
 
 
 

 


Then you should see 'PDF Document Site' as a template when you create a new site:
 
 
 
 
Your site will look like this:
 
 
 
The Documents library has a column set automatically by workflow that opens the PDF in the browser:
 
 
 
Here what a PDF looks like full screen.
 PDFSite_PDFViewer.PNG