Select to view content in your preferred language

Upload PDF document that can be embedded in a web experience

306
2
03-21-2025 07:07 AM
CameronLacelle
Frequent Contributor

Bit of an odd question but I have written some comprehensive user guides and tutorials for some of our Enterprise applications to help make our end-users experiences a bit easier for learning these new applications. What I want to do is upload these documents to our Portal and then use the portal item link in an Embed Widget in Experience Builder and have the PDF doc embedded and interactive right in the application. I have tried this and noticed a couple things: you can only use the item link if the sharing is set to public, and when I embed that link into ExB it just downloads the PDF document rather than embedding it.

I am wondering if anybody else has wanted to do something like this and has found a solution to do this? Kinda just taking a shot in the dark here, if there's no real way to do this then I'd probably just copy and paste the contents from the word doc into a text widget and insert the images but this is the lesser preferred option.

2 Replies
VirginiaH
New Contributor

Did you ever figure this out/resolve, or find a suitable workaround for this? If so, can you share? I'm having challenges with this also. Thanks!

 

0 Kudos
CameronLacelle
Frequent Contributor

Hello,

 

I did some digging into this and there seems to be some sort of network security type of thing that prevents a PDF link from being "trusted" to be embedded directly into the application. Not only have I seen this with Experience Builder's embed widget but also in having PDF documents from outside our AGOL/Enterprise as a Document Link in a Hub Page (refuses to connect).

 

My workaround for what this original post was about what to use the Embed Widget in ExB and code in a couple of download buttons that link to the PDF documents I had uploaded to our Enterprise so our users could click the button and download the PDFs. Not quite as shiny and fun as having it display right in the app, but it serves the purpose needed for our end users.

 

So I'd recommend using HTML coding as a workaround and embed that into your application. Generally this is the HTML code that I ended up writing. The style stuff at the top allows you to customize how the buttons will look (for mine I just made them match the theme of our application so it is consistent). Then when you use the <a href> you can put in your document name or the link for it if you've uploaded it to your Enterprise environment (use the REST Endpoint link, but I think your document needs to be shared as public to get a link which is unfortunate). There is lots of helpful HTML documentation out there to help!

<doctype html />
<html>
<head>
<style>
a:link, a:visited {
background-color: #HEXCODE;
color: white;
padding: 14px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
border-radius: 10px;
}

a:hover, a:active {
background-color: #993d41;
}
</style>
<title>TITLE OF HTML</title>

</head>
<body>
<h1 style="font-family:verdana">HEADING FOR HTML PAGE</h1>

<a href="DOCUMENT NAME OR LINK" download style="font-family:verdana">DOCUMENT DISPLAY LABEL</a><p><p>

<a href="DOCUMENT NAME OR LINK" download style="font-family:verdana">DOCUMENT DISPLAY LABEL</a><p><p>

</body>
</html>

0 Kudos