Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

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>
</object>
share|improve this answer
    
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. –  iNvidia Apr 29 '13 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 '13 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! –  iNvidia Apr 29 '13 at 15:56
add comment

Please use this approach for only allowing PDF, in Powershell

$webapp = Get-SPWebApplication <your webapp url>
$webapp.AllowedInlineDownloadedMimeTypes.Add("application/pdf")
$webapp.Update()

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

share|improve this answer
    
Note: If copy/pasting this take care not to use the "Smart Quotes" around the mimetype. –  Neil White May 29 '13 at 9:42
    
Fixed that error, thanks! –  Robert Lindgren May 29 '13 at 9:43
add comment

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

Regards

share|improve this answer
    
Try my powershell above, should work and let's you only enable rendering of PDF:s –  Robert Lindgren Apr 30 '13 at 11:43
    
Did you clear your browser cache after trying the mimetype approach? –  Neil White May 29 '13 at 9:40
    
yes i've cleared the browser cache and was same. Now problem is solved with the above approach. –  iNvidia May 29 '13 at 11:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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