I'm trying to display PDF in sharepoint aspx webpage.Using this code inside in aspx page <object><embed src="http://example/example.pdf" height="600" width="600" type=""></embed></object>

Once i save the page on preview apear grey color for the size of 600x600. I'm not using webpart > content editor because i don't have the html editor button unable and is best for me to work directly in the code.

3 Answers 3


The syntax you want to use would be something like this:

<object data='url/to/file.pdf' type='application/pdf' width='600' height='600'>
    <p>It appears you don't have a PDF plugin for this browser.</p>
  • Thank you but unfortunately is displayed in same way, just the grey area and i don't know what can be the reason. If i insert wrong path of the PDF it's says that the pdf couldn't be loaded. But if is the right path only the grey color is displayed.
    – netdesignr
    Apr 29, 2013 at 15:24
  • 1
    Sounds like the mime type needs to be added. Check these links out for some help with that. gallery.technet.microsoft.com/office/… forumaspnet.wordpress.com/2013/01/10/…
    – iOnline247
    Apr 29, 2013 at 15:36
  • can you please guide me to install this mime type script?...it will be good to try maybe it will gonna fix my issue. Thanks a lot!
    – netdesignr
    Apr 29, 2013 at 15:56

Please use this approach for only allowing PDF, in Powershell

$webapp = Get-SPWebApplication <your webapp url>

So you don't have to allow all file types by setting file handeling to permissive

  • Note: If copy/pasting this take care not to use the "Smart Quotes" around the mimetype.
    – Neil White
    May 29, 2013 at 9:42

Finally manage to fix the issue.

Central Administration > Manage web applications > click on http://yyy/ then General Settings > scroll down to Browser File Handling and select Permissive

This is not very recommended but i think is best if the mime type doesn't do the thing. However thanks for your time #iOnline247


  • Try my powershell above, should work and let's you only enable rendering of PDF:s Apr 30, 2013 at 11:43
  • Did you clear your browser cache after trying the mimetype approach?
    – Neil White
    May 29, 2013 at 9:40
  • yes i've cleared the browser cache and was same. Now problem is solved with the above approach.
    – netdesignr
    May 29, 2013 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.