Embedding PDFs in SharePoint

August 20, 2010

— update 30th November 2012 —

I always love it when someone points out a simpler solution to a question or problem. Jake added a comment having discovered that using the Page Viewer web part to point to the URL of the PDF file achieves the same result. An option I’d forgotten all about and arguably a cleaner and simpler approach:

  • Add the Page Viewer web part to the page.
  • Copy the shortcut to the PDF as outlined below, and paste into the web part properties
  • Configure the usual web part properties to control width, height etc. as appropriate
  • Done! No fiddling about with source code to get the HTML to behave as you want

— original —

This question cropped up a couple of times in the comments to the Adobe PDF Indexing blog post

How do you open a PDF in a web page on SharePoint?

Here is the method I use. There may be prettier and better ways to do it. If you know of one, please add a comment.

The short version:

  1. Take one Content Editor web part
  2. Enter <embed> tags containing the PDF fie as the source

The longer version:

  1. Upload the PDF you want to display to a SharePoint library. From within the library, right click the PDF file name and select ‘Copy Shortcut’ (this takes a copy of the full URL to the file)
  2. Add a ‘Content Editor’ web part to a SharePoint web page.
    • If you’re using SharePoint 2007, it’s in the Miscellaneous group in the web part gallery
    • If you’re using SharePoint 2010, it’s in the Media and Content group in the web part ribbon
  3. Edit the web part to insert your code
    • SharePoint 2007 – Modify the web part and click the Source button in the task pane (not the Rich Text Editor button)
    • SharePoint 2010 – In the ‘Format Text’ ribbon, click the HTML Editor button
  4. Insert the code
    • Click CTRL + V to paste the shortcut to the PDF file
    • Then add the following code, using your shortcut in place of FILENAME.PDF
       <object><embed src="FILENAME.PDF" height="600" width="600"

      Here’s an example:

    • Click OK/Save to save the code and then OK to save the web part
  5. You should now see your PDF file displayed in the web part. If required, adjust the height and width values until the PDF is displayed how you want it (preferably one full page in view). In SharePoint 2010, the code may have been modified a little – don’t panic.
  6. Save and publish your page (or Stop Editing, depending on what site template and version of SharePoint you are using)

Hey presto: One PDF document viewed inside a SharePoint web page. Cue free advertising for the last PDF that arrived onto my computer :-)


You must use the Content Editor web part for this task. If you try adding <embed> tags to a standard page control (for embedded content within the page), SharePoint will remove the tags when the page is saved and your hard work will disappear. If you’re running SharePoint with extra strong mints security, you may also find the <embed> tags are stripped out when attempting to save your work.

People will still need a PDF reader installed on their client in order to view the PDF embedded in the web page, just the same as when visiting any other web site with embedded PDFs.

Update 30th Apr 2012: Beware the dreaded 64-bit edition of IE. I’ve seen it cause challenges with various different software and web site features. Add this one to the list – more details kindly shared by Terri in the comments.

Sharon Richardson


48 responses to Embedding PDFs in SharePoint

  1. Hi Sharon
    Nice post! Do you think this same procedure would work with an excel spreadsheet?

  2. Hi Jake

    Many thanks :-) The easiest mechanism now for embedding spreadsheets is to use the new Office Web Apps which include the ability to embed PowerPoint presentations and Excel spreadsheets into web pages. There’s a post coming up on that… If you can’t use the new features, the older method used to be using the Office ActiveX controls but they were discontinued after Office 2003 and are hard to come by. The in-between method specifically for spreadsheets if you have SharePoint 2007 or 2010 Enterprise Edition would be to use the Excel Web Access web part that is included (not available if you’re on Standard Edition or Windows SharePoint Services/Foundation).

    Hope that helps. Drop a note here if you have further questions.

  3. This will work for every PDF saved in the library. Just copy the code and change the “FILENAME.PDF.” and you will have all the PDFs viewable. Trying to get it to work on Excel and word documents and it is not working.

  4. Hi Frank, this tip is PDF-specific, it won’t work for any Office documents. I’ve just published a new post on how to embed Office docs into SharePoint but the news isn’t all good…


  5. THANKS! – not many of these blogs are so straightforward and work as simply and effectively as this. I sthere any way to turn off the PDF toolbar in the embedded viewer, or is that a viewer setting?

  6. Thanks Jess

    And as far as I’m aware, unfortunately no, you can’t turn off the toolbar as it’s part of the default PDF viewer.

  7. Hi Sharon, thanks for the post. I am relatively new to SP2010 and tried to follow the steps, but they didn’t work. After I add the Content Editor web part, I want to edit to add the code snippet you suggest. Is the only way to edit the content in HTML form on the page level?

    Any help is greatly appreciated as this looks like the perfect solution for what we are trying to do.


  8. Hi Bryan

    The only way to add the code is by adding the Content Editor web part and then, with the cursor placed inside the Content Editor web part, click the HTML icon in the ribbon. Paste the code in to the source editor. Make the changes to point to your filename, then save.

    Any other method – such as clicking the HTML icon from within the page itself (instead of the web part), or going to update an existing content editor web part – will not work. SharePoint will strip out the code.

    If you’re still stuck, I’m going to start a monthly Live Meeting session that anyone can attend and ask questions. We can walk through this procedure if you can attend. Will post an announcement in the next week.

  9. Hi Sharon,
    Thank you for above instruction.
    I get as far as clicking OK to the HTML-text – and see the PDF-viewer.
    But as soon as I select Save&Close everything disappears and I’m stuck with an empty Content Editor.
    Maybe this is the high security level? But where do I check and edit the security level? I am full administrator, we are running Sharepoint Foundation 2010.

  10. Hi Lea

    First of all – you can only do it once. If the Content Editor doesn’t display correctly on save, you’d need to delete the web part, then add a fresh Content Editor web part and start all over again. If you ever go back in and edit the web part, it will strip out all code and you have to delete and start all over again. It’s quite a fussy little devil.

    It might be a security issue – if you’re using a browser directly on the server, make sure the enhanced security mode is switched off and add the SharePoint URL to the Intranet zone. See how that goes.

    Cheers and regards


  11. Hi Sharon,

    Great article! But all it shows on this system is a small grey icon. I’ve got the ifram installed, file type added and let SharePoint change to code (after being sure it keeps the ogject & embed codes). It does not show the pdf content. Only that strange little grey icon. Once I get this working I will need to test that the login id matches the metadata column for username (they can only see the one doc assigned to them).

    Any suggestions? Thanks!


  12. Hey Rob

    Apologies if I’m checking the obvious but you do have Adobe Reader installed?

  13. I’ve been using a similar technique on my SharePoint site. One complaint I get is that the pdf reader (and also Word) get cropped on the left and right sides, which some find aesthetically displeasing. I see that your example has the same problem. Is there any known cure?


  14. Hi John

    I don’t know. In this case, we’re using the embedded controls provided by the software. You could try a different PDF reader/control but afraid I’m not much help here.

    Cheers and regards.

  15. Hi Sharon,

    Great article! In your article “Sharepoint 2010 and Adobe PDF”
    Aaron and Dave ask if there is a way to prevent saving and printing. You answered that you would use server control stream through Adobe Flash Player.
    (Cool recommendation!)
    Is there also an article about how to do this in Sharepoint?

    thx, Holger

  16. Hi Holger

    From the SharePoint side, you’d still just insert the embed code but for a different type of player. One that doesn’t include the options to print, save etc. If you look at sites like Scribd and Slideshare, people can choose the options available for documents uploaded, such as whether or not people will be able to print, download or embed. The features are outside the player, so when you embed you just get a player – can scroll through the pages/slides but nothing else.

    Hope that makes sense.

    All the best


  17. Thanks Robert, haven’t delved too deep into what additional parameters can be added to the embed code. Good to know it can be done and thanks for sharing the link.

  18. Hi Sharon,
    This post was helpful. Do you know if there is a way to connect the content editor with a document library or a treeview list of documents? So when you click on a document in the library it will show up in the editor. Thanks.

  19. Hi Tanya

    Thanks. Off the top of my head, no I don’t. You can do a menu dropdown for a media player web part (to pick a video to watch) so I’m guessing could maybe hack that to do something similar but it would be a manually created menu, not automatically created by pointing at the document library.

    The easiest to implement but takes manually work would be to create a page per document, and then they can be accessed via the sidebar navigation by simply clicking each page. Extra work but easy and stable to use.

  20. I would love to use this, but it just plain isn’t working…keeps stripping the code. So in the HTML editor, I paste the code along with the path to the file and I click ok at the bottom. It takes me back to the page in edit mode and I can see the .pdf displayed in the content editor web part.

    next, I am clicking Save & Close on the page. At this point, I am still looking at the page and can see the content editor web part, but my .pdf is no longer displayed. Am I missing something?

  21. Hi Zane

    It’s tricky little beast to get working. The problem will almost certainly be in your security settings – either the browser or how SharePoint has been configured.

    One possible option would be to configure the content query web part externally, then import it into SharePoint. It’s just an XML file when all is said and done. Haven’t given this a try (will when I’ve got one of the VMs powered up), but drop a CQWP onto page, type something so it has some HTML content. Then export to your desktop. From the desktop, right-click and open in Notepad or similar. You’ll see all the XML tags storing the properties and content of the CQWP. You should be able to find the line containing the HTML content. Insert what you need there and then try importing back in.

  22. how we can embed the excel file in the same way?

  23. Hi Komal

    See related blog post http://www.sharepointsharon.com/2010/10/embedding-office-docs/

    Excel is easiest of the Office apps if you have SharePoint Enterprise edition….

  24. Regarding the amount of possible PDFs there could be on one SharePoint site. Is there a way to have a PDF file reference back to only one page with that content editor on it? So you don’t have to individually create the same code for different files.

  25. Hi Daniel

    You could probably do it with scripting but if you have lots of different files, just letting the PDF open on click may be a more efficient approach.

  26. Great post

  27. Just wondering how you would do that on a list form. I have an attachment on a list item that I want to preview on the edit page instead of having to click the attachement. Is there a way to do that?

  28. Hi Guradatta – thanks! :-)

    Hi Scott – not without resorting to code I’m afraid, you need script so that as you hover over a list item, it previews in a separate iFrame. That’s a bit trickier to do and I try to stick to ‘no coding required’ solutions here.

  29. Sharon,

    I too am interested in adding a .pdf to a page and following your instructions it works great, until I click on the Save and Close button. The webpart disappears and my work is lost.

    Any suggestions?

  30. Hi Phil

    You’ve got to be really careful about adding it into the HTML source box and then not doing anything at all from within the web part that could give the excuse to modify the HTML (that will strip out the embed if it’s not saved).

    Make sure you are using a later version of IE (8 or 9), edit the source and then immediately save and close. But it is a tricky fiddly ugly process. Microsoft has gone a bit too heavy handed on the security side for certain scenarios.

  31. Sharon, great work… Could this be used for users to fill out and save to the pdf form or document in the same library (or anywhere else in SP)? I’m trying to make it so users can edit the pdf in the browser as say part of a task or workflow, but as soon as you open it and make changes it forces the user to save it locally. Any thoughts?

  32. Hi Brad, many thanks :-)

    Sounds more like InfoPath would be a fit unless you deploy the Adobe Reader to all clients and have the full Adobe Acrobat suite for creating editable forms. The UK government has taken the latter approach with filing certain financial information. But it requires specifically Adobe Acrobat Reader. Other applications able to read PDFs aren’t able to edit them.

    So, depends on your overall IT strategy. If Adobe is part of it, then potentially yes with coding. I’ve seen web sites implement this and can’t see a reason why SharePoint couldn’t allow the same but it will require work. Otherwise, consider InfoPath which is SharePoint’s built in web forms service and can include workflow to do all sorts of fun stuff.

    Good luck!

  33. Great post… but… not working for me. I’m getting the little red x that normally indicates a broken link in the CE web part. Have tried full path, main docs lib, local site docs lib, and checked and rechecked my settings. Acrobat Reader is installed on the server and locally. If I try to open the pdf from the library, no problem – click and open. Suggestions?

  34. Seems the problem is something with IE – not SharePoint. Tried the page in both Chrome and Safari – no problems. Odd that. The site is in the trusted group in IE.

  35. Found it… I have the 64 bit IE running – on the 64 bit server with the 64 bit SharePoint. Once I switched to the 32 bit IE, I can see the PDF just fine.

  36. Hi Terri

    Thanks for persevering and sharing the problem/resolution. It’s interesting, issues with 64-bit IE crop up all over the place. I run 32-bit by habit even on 64-bit laptops and would never have spotted the issue here as a result.

    Will add a note in the post as it’s an item to check whenever you hit a wall and everything looks like it should be fine.

  37. I love your wp format, where did you get a hold of it? 472756

  38. It’s based on the iBlogPro 3 theme. Or rather it was. New theme has now been applied. Similar but using a responsive design for better navigation from tablets and phones.

  39. Great site! I’ve found that you can also embed a PDF by copying the PDF url in to a Page Viewer (done in SharePoint 2010). I prefer using the Page Viewer becuase it is easier to update.

  40. Thanks Jake – that’s quite possibly a far better approach than this one :-) I may add a note at the start pointing to it.

  41. Giles Hamson provides more information about working with pdf files, with links to great resources from adobe – alot of ways to customize what shows up as far as toolbars and functionality, etc. within the iframe or embed code.


  42. Sharon – I have followed the above directions over and over again. Thought maybe I missed something however everytime i do it in a new web part i get the same results. I get a blank screen with the red X and nothing appears. Is there another way to do this or am i doing something wrong??? Help please

  43. Hi Charlene

    A dreaded red X usually means one of three things:
    1- there’s an error in the file path meaning the file can’t be found to be displayed
    2- the filepath is correct but can’t be reached without some intermediary action like an login
    3- the browser being used doesn’t support displaying PDFs

    The easiest test is to get the shortcut to the file and then paste it direct into the browser. If your browser can’t display the PDF, it will either display the red X too or, more likely, will launch a locally installed PDF reader like Adobe Reader. If the browser is able to display the file without launching a client application, then something is going wrong within the configuration of the web part.

    Hope that helps.

Trackbacks and Pingbacks:

  1. Tweets that mention Embedding PDFs in SharePoint -- Topsy.com - August 20, 2010

    [...] This post was mentioned on Twitter by Joining Dots, SharePoint Sharon. SharePoint Sharon said: New blog post: Embedding PDFs in SharePoint web parts http://bit.ly/bUgqMn [...]

  2. How to Embed a PDF Document in a SharePoint Wiki Page « Learnings as a SQL Server DBA and Developer - October 16, 2012

    [...] There is another way to embed a document using a Content Editor web part too (shared here and here) but I’ve not had a chance to try that [...]

  3. Display PDF File Within SharePoint Page | The SharePoint Effect - November 1, 2013

    [...] References – Embedding PDF’s in SharePoint [...]

  4. How to Embed a PDF Document in a SharePoint Wiki Page with a Page Viewer Webpart | Learnings as a SQL Server DBA and Developer - April 24, 2014

    [...] There is another way to embed a document using a Content Editor web part too (shared here and here) but I’ve not had a chance to try that [...]