Skip to main content
Participant
June 26, 2022
Question

File Preview Error: Can't use different PDF URLs

  • June 26, 2022
  • 1 reply
  • 619 views

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 has been closed for replies.

1 reply

cfjedimaster
Inspiring
July 21, 2022

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>. 

Participant
October 4, 2022

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.

cfjedimaster
Inspiring
October 7, 2022

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