How to Embed a Public SharePoint PDF on an External Website
Question details
The user needs to embed a SharePoint-hosted PDF into an external website so that all visitors can view the document without being prompted to sign in to a Microsoft account.

- Product
- Microsoft SharePoint
- Device & OS
- not provided
- Scenario
- Displaying a PDF hosted on SharePoint on a public-facing external webpage using an iframe embed code.
- Observed behavior
- The embedded PDF successfully loads for the file owner but displays an access-denied message or a sign-in prompt for public visitors and users in private browsing mode.
Verify with your Microsoft 365 IT administrator that your organization's SharePoint tenant policies permit anonymous external sharing and iframe embedding for documents.
Generate an Anonymous Sharing Link
Create an 'Anyone with the link' URL in SharePoint to grant public viewing access without requiring visitor authentication.
SharePoint files default to restricted access based on your organization's directory. To embed a file publicly in an iframe, you must generate a special sharing link that explicitly bypasses the sign-in requirement.
Navigate to your SharePoint document library, locate the target PDF file, right-click it, and select 'Share' from the context menu.
Click the gear icon or the current link scope button, then select 'Anyone with the link' under the sharing settings to enable anonymous access.
Click 'Apply' and then 'Copy link'. Replace the restricted SharePoint document URL in your website's iframe HTML tag with this newly generated public link.

Host the PDF on a Public Web Server
If your organization's security policies forbid anonymous SharePoint links, you must host the document on a service designed for public access.
Easily Manage and Edit PDFs with WPS Office
While SharePoint limits how you host and share documents online, creating and editing professional PDFs doesn't have to be complicated. WPS Office is a free, lightweight alternative to Microsoft Office that offers a comprehensive suite of built-in PDF tools.

Frequently Asked Questions
Why does my embedded SharePoint PDF show an access denied error?
By default, SharePoint requires users to authenticate to view files. If you use the standard browser URL in an iframe, visitors who are not logged in or do not have explicit permissions will be blocked by SharePoint security policies.
How do I test if my PDF embed is working for public visitors?
Open your external website in an incognito or private browsing window where no Microsoft accounts are currently signed in. If the PDF displays correctly without asking for credentials, your public access is successfully configured.
Can I force SharePoint to allow iframe embedding on my domain?
SharePoint administrators can use the 'HTML Field Security' configuration in Site Settings to allow or restrict specific external domains from embedding SharePoint documents. Ensure your website's domain is added to this allowed list if iframe restrictions are active.




