Skip to main content
Participant
Jun 26, 2022 7:22 PM UTC
Question

File Preview Error: Can't use different PDF URLs

Here is the code. I have tried several other PDF urls and none work except for the sample Adobe ones. I am 100% sure I am overthinking and there is a very basic step which I am missing, but can't figure it out. 

<div id="adobe-dc-view"></div>
<script src="https://documentcloud.adobe.com/view-sdk/main.js"></script>
<script type="text/javascript">
	document.addEventListener("adobe_dc_view_sdk.ready", function(){ 
		var adobeDCView = new AdobeDC.View({clientId: "<YOUR_CLIENT_ID>", divId: "adobe-dc-view"});
		adobeDCView.previewFile({
			content:{location: {url: "https://www.nature.com/articles/s41586-021-04116-8.pdf"}},
			metaData:{fileName: "s41586-021-04116-8.pdf"}
		}, {});
	});
</script>

I have seen different posts similar to this, but none of the answers were clear/helpful in my case. 

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

cfjedimaster
Inspiring
Jul 21, 2022 4:58 PM UTC

Most likely it's a CORS issue, where the PDF you are trying to load from another domain has not been configured to allow other domains to load. If not that, ensure you have a real client id, not <YOUR_CLIENT_ID>. 

Translate
Participant
Oct 4, 2022 8:17 PM UTC

Hi, sorry for the late reply. I am able to load the PDFs in an iframe, but I have not been able to get a single PDF to work with the Embed API. I have a browser extension which allows CORS so it shouldn't be an issue, but for some reason no link I use works with the Embed API (even when I use the Client ID). I tried to see if it would work with others, and they were also running into the same issue. iframes are very limited as you know in their PDF viewing ability, so if we could get the Embed API working, it would be a lifesaver.

Translate
cfjedimaster
Inspiring
Oct 7, 2022 8:09 PM UTC

Can you share the URL online where I can see you using it? If it's private, feel free to email me at jedimaster@adobe.com. 

Translate