Subscribe via RSS Feed Connect with me on LinkedIn

Embedding PDF’s into SharePoint 2010 pages

[ 32 ] March 14, 2011 |

Recently   I was asked by a client to see if you can embed a PDF into a SharePoint page. It turned out to be surprisingly easy!

I am assuming that you are using Wiki pages in your team sites in this example. Either way you have to put the embedded code into a  Content Editor Web Part for this to work. If you put the code to a standard page then SharePoint will strip out the tags and this will not work Sad smile

First you need to find the URL to the PDF that you wish to view, after that you are ready to go!

Step 1)

Add a Content Editor Web Part to the page


Step 2)

Click on the ‘Edit HTML Source’ button for the Content Editor Web Part (not the page)


Step 3)

Add the following code:

<object><embed src="FILENAME.PDF" height="850" width="850"


  • src = The URL of the file, remember to put in a server relative URL to this!
  • height = height of the rendered PDF
  • width = width of the rendered PDF

Click on Save and you should see your PDF rendered out just like the example below! By the way this book by Phil Wicklund is awesome, check it out here.


Tags: ,

Category: How To

About Michal Pisarek: Michal Pisarek is the founder of Dynamic Owl Consulting and a Microsoft SharePoint MVP. View author profile.

Comments (32)

Trackback URL | Comments RSS Feed

  1. […] Embedding PDF’s into SharePoint 2010 pages […]

  2. Reto says:

    What is about the SharePoint 2010 Blog Sites.
    Do you have also a solution for blog entries?
    I tried, but SharePoint remove the code automatically.

  3. […] empfiehlt HTML Code (und HTML Code generierende Java Scripts) einzubetten  z.B. durch Änderung des HTML Codes der Seite mit dem Sharepoint Editor oder mit dem Sharepoint Designer. Dabei scheint es aber viele […]

  4. Great post. Also, if you want to do this dynamically a colleague of mine did a good article to compliment this one:

  5. I tried this out, it looks like it works, but once I click save Sharepoint changes the HTML code.
    Any suggestions?

  6. Hey Michael,

    Are you sure that you are adding in the content into a Content Editor Web Part? If you are doing it directly on a page then it will strip out the HTML

  7. Matt Bramer says:

    I’ve actually done something similar with DVWP’s. I created a template with will dynamically render the file directly in SharePoint. Doesn’t matter what is chosen as long as you can embed it into a web page, it’ll render. Here’s a demo:

    and the codeplex project:


  8. Hey Matt!
    That is cool.
    Thanks for the comment.

  9. Kirk says:

    I am having the same problem as Michael. How do I ensure that I am editing the HTML on the Content Editor Web Part? There is no button on that web part properties.

  10. Kirk says:

    When I edit the HTML coed in the Content Editor Web Part the preview shows great, though a message says that the code “may have been modified”. When I click OK or Apply, the pdf disappears and shows a blank screen.

  11. Marcus says:

    Im having the same problem as the other guys. It looks good in preview but when I save I get a message that my code might have been modified and then the webpart turns grey. When I go back to look at the code it has indeed changed and now looks like this:

  12. Marcus says:

    dont think the code was posted.. wierd.. i’ll try again, this time with a dot inside the object:


  13. Hey Marcus.
    Make sure that you are editing the HTML in the CEWP and not on the page that it is embedded in.

  14. Kai Weber says:

    Is it possible to do that thing dynamically. I want to embed pdf-documents from a list. So whenever you select a pdf-document in that list or library it will be displayed in a frame?

    Any idea?

  15. Peter says:

    Matt Bramer,

    That is a good example of displaying PDF into sharepoint page. I am looking to do the same but I like to know how to inject all that code into sharepoint page?

    I mean do i have to add data view web part and then add provided code?

    Or do i just add Content editor webpart?

    The example shows that there is a ASPX dropdown which pass parameter to display appropiate PDF (files).

    Please provide any helpful details based on your experience.

  16. Prem says:

    Great useful tip :)

  17. Zarko says:

    Hi and thanks for this great solution. I am trying to do the same with .docx files but nusuccessfully yet. Any help would be appreciated.

    Thanks in advance

  18. Renuka says:


    I have the same problem like Kirk and Marcus has.When I edit the HTML code in the Content Editor Web Part the preview shows great, though a message says that the code “may have been modified”. When I click OK or Apply, the pdf disappears and shows a blank screen.I’m using IE8 and sharepoint 2010.Can anyone please add the screenshot of the entire HTML code in CEWP? I’ve been trying since long time but I’m still stuck with this issue.

  19. Abe Ibrahim says:

    Your demmah is resolved – the code and (steps -1) are corrrect and works great; the (-1) is for one missing note.
    Step 1a. Before you do step 2, click in the area below the Web-Part’s name, and it will work!

    Happy Coding!

  20. Matrix says:

    Thanks. The code works great. Many sites have similar but the codes are not correct. The code above 100% works!

    To those who have blank screen problem, you may need to zoom the PDF out (because it tries to fit everything into the box, hence it’ll become very small as the file page size ratio is different). It is best you installed Adobe X reader when you are doing this. Some other PDF reader might not show the results correctly or have the handy zoom in/out feature when you mouse over the PDF display area.

  21. […] permanently. 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 […]

  22. Steve Roh says:

    This solution work perfectly with FireFox, but in IE9 I got a red cross instead of the PDF document…
    Any idea about this problem ?
    Thanks & Regards,


  23. Taffy Lewis says:

    Steve, I also got the read cross, so looking at your post, I got it to load in firefox–so, does anyone have the answer for IE9?????

  24. Ben says:

    Worked on my IE9(32 bit)

  25. Nancy Chen says:

    Do you still need PDF Viewer in SharePoint? Foxit has built up a PDF Web Reader Solution for SharePoint and would like to recruited beta volunteer. If you are interest in this, please contact for more detailed information. Thanks.
    Foxit PDF Web Reader Plugin for SharePoint is a document library extension product of SharePoint. The installation and configuration can be done by administrators in a SharePoint environment. The end users of SharePoint system can view PDF files online with using browser and no need to install any viewer application or plug-in locally.

  26. Michael Stever says:

    This does not work with Adobe Reader XI – with protected view enabled

  27. Brad says:

    I know I’m late to the forum, but for those of you still having the same issue as Michael and Marcus, try to manually type the code in rather than using copy/paste.

  28. Angel says:

    It worked! Thank you!

  29. sam says:

    Thanks, I used the steps and it worked for me. Just wondering now if I want to go a next step and allow users to be directed to a certain page of the pdf, based on their role, how is this done?

    i.e Enter role: Assistant
    Action – Highlight or got to page in pdf that applies to this assistant role only.

    many thanks!

  30. Joseph Johnson says:

    To those who are having problems getting this to save, I think the author skipped an important step in the process. After inserting the content editor web part you need to click on the downward arrow on the right side and click edit web part. Then you can insert the HTML into the content edit web part, not the master page. When you open up the HTML editor of the CEWP it will be blank. If you are opening the master page HTML and add the code it will display lots of other code. Then when you add the code it will display the PDF until you save it. I think Sharepoint is rejecting any custom code in its master pages unless you do it in Sharepoint designer. Hope that helps! Great post!

  31. Brandon says:

    This works great!!


  32. Dimitri says:

    I uploaded a PDF file onto an excel sheet and put it on sharepoint. The file i uploaded is a picture of the blueprints for the company i work for. When i try to edit it so i can add where people are sitting, the file is so small. Its only so small when i press “open in excel” and then “edit” but when i save it, its normal size. how do i make it normal size when im editing it. If i make it a normal size onm the edit page, it is huge when i save it and open it again on the sharepoint

Leave a Reply

If you want a picture to show with your comment, go get a Gravatar.