3

I am trying to embed Word (DOC, DOCX) and PDF documents in a page but getting into trouble.

  1. When I embed PDF document using IFRAME or OBJECT tag then the document displays fine on Chrome but on IE8 it asks to download.

  2. When I embed Word document using IFRAME or OBJECT tag then in both IE8 and Chrome it displays error "This action couldn't be performed because Office doesn't recognize the command it was given"

How to fix these issues? Is there a reliable way of embedding documents for all major browsers like IE, Chrome, Firefox, Safari?

3 Answers 3

7
  1. Copy the address of a PDF file in a document library. (via the ellipsis)
  2. Go to a web part / wiki SharePoint page.
  3. Insert Web Part
  4. Media and Content > Page Viewer Web Part > Insert
  5. Edit web part
  6. keep web part settings as "web page"
  7. paste URL in the URL field
  8. click apply (resize web part height if need be)
  9. save page

Office Web Apps if installed and connected to your SharePoint farm will render the PDF file on the web page inside Word Web App.

Note: the url to the word/pdf file will end with the parameter ?Web=1 after the file name as this is what makes a office document open in Office Web Apps.

0

This is what I've used before to display pdf's and it has never asked me to download in Chrome or IE.(I answered with this on a different question so you know)

I have personally used the Content Editor Web Part (Located under Media and Content) to display various documents within the page (no need to have the page be opened on an entirely different page) maybe this is what you would want?

To do this, add the Content Editor on your page. Select "Edit Web Part" then click on the text that appears on the web part ("Click here to add new content").

At this point it should look like you are about to type in a text box. Now click "Edit Source" on the Format Text ribbon. This will edit the HTML within the Content Editor itself instead of the entirety of the page.

Now insert this code:

<object><embed width="850" height="850" src="..." type="application/pdf"></object> 

As you can see there is a src"..." where the ellipses are put the link to your document or image or whatever that you have stored within your SP site. (this might take some playing with the link). This case also is for a pdf and you might need to change that application/pdf - might work with any document type however.

5
  • He has already used object tag. He has mentioned it in his question.
    – Akhoy
    Commented Aug 3, 2015 at 17:01
  • But where exactly has he? I know if I try to embed within the script editor it doesn't work and it will strip out the HTML but it HAS worked for me inside of a content editor. I should've included that question since it isn't really said.
    – calebben3
    Commented Aug 3, 2015 at 17:36
  • I am using OBJECT tag in web part. Tried using CEWP but it always changes HTML tags like < to &lt; Regarding IE, I read another post here that this is how it will work in all versions. But I came here to see if there is a solution. I am using IE8 by the way. Commented Aug 3, 2015 at 18:20
  • Hmm.. I'm not super savvy with SP. I just needed a work around to get a PDF displayed in page and my above answer worked with me - lots of the time SP would strip out my tags and do goofy stuff like you've said but I just tried different web parts and placements until it worked. Maybe if you tried something like the code above within SP designer it might work for you (Where I work access for that is hard so I can't tell you from personal experience on that one)
    – calebben3
    Commented Aug 3, 2015 at 19:28
  • @calebben3, you solution is working in firefox, not working in IE.
    – Tortoise
    Commented Apr 1, 2019 at 10:19
0

IE asks for downloading the PDF file instead of displaying it inline because of a SharePoint security setting.
You can disable this behabior by changing that setting: from the Central Administration, go to "Application management", select your Web app, then "General settings" and set "Browser File Handling" to "permissive".
Note there's other more granular ways to change this behavior, see for instance https://sharepointsoldiers.wordpress.com/2011/11/03/permissive-mode-in-browser-file-handling/.

Your Answer

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

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