Display pdf file from SharePoint into external website

Anonymous
2021-02-19T19:18:33+00:00

Hello! My question is if it is possible to embed a pdf file which is allocated in SharePoint into an iframe from external website.

When I put the url from this pdf file into an iframe:

<iframe src="http://sharepoint/*/_layouts/15/DocIdRedir.aspx?ID=bbbbb" width="100%" height="100%">

</iframe>

in my web page, it returns an error about "Refused to display in a frame because it set 'X-Frame-Options' to 'sameorigin'."

Is there any way I could display the pdf file from SharePoint?

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Anonymous
    2021-02-20T07:36:54+00:00

    Hi ximenagonzalez,

    Thank you for posting your question in this community. From your description, you are trying to embed a PDF file in SharePoint to an external website.

    I am not sure what kind of external website you are trying to embed, such as a HTML based web site. But generally, the embed code we can use to embed is like below, which it can be used in different SharePoint site with embed web part:

    <iframe width="500" height="500" src="Your PDF file link here"></iframe>

    I suggest you can try out this embed code and see the result. You can change the width and height number to adjust the size to display PDF file. And paste your SharePoint PDF file link into Your PDF file link here section.

    Note: Make sure your PDF file link is a public link to ensure everyone can access this PDF file/ Otherwise there might be some permission issue to view the file.

    You can generate the PDF file link in SharePoint site by selecting the PDF file > Share > choose “Anyone with the link can view” and insert into embed code above.

    Best regards,

    Dihao

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2021-02-25T07:05:13+00:00

    Hi ximenagonzalez2,

    Have you solved your problem with the above method? If there is any problem, please let us know feel free.

    Best regards,

    Tin

    0 comments No comments