0
API Code is not loading correctly on site?
New Here
,
/t5/acrobat-services-api-discussions/api-code-is-not-loading-correctly-on-site/td-p/11906206
Mar 17, 2021
Mar 17, 2021
Copy link to clipboard
Copied
I am using the code snippet from the Document Service PDF embed API service, which is not working correctly on my end.
I am getting the following error:
Here is the code I am using:
<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: "6d2b4b4b70c64a0c9b71a2fed484e645"});
adobeDCView.previewFile({
content:{location: {url: "http://www.corclinic.com/downloads/COR_PhxMag_reprint_0408.pdf"}},
metaData:{fileName: "COR_PhxMag_reprint_0408.pdf"}
}, {embedMode: "LIGHT_BOX"});
});
</script>
Can the source PDF be from any website, or does it have to be stored on the adobe cloud for this work? Thank you
TOPICS
Document Generation API
,
How to
,
PDF Embed API
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/acrobat-services-api-discussions/api-code-is-not-loading-correctly-on-site/m-p/11906237#M1430
Mar 17, 2021
Mar 17, 2021
Copy link to clipboard
Copied
from the documentation...
Cross-origin resource sharing (CORS) issues may occur when you pass PDF content as a URL and the PDF Embed API needs to download the file from the provided location in order to render it. To avoid this situation, you can choose one of two methods:
- Locate your webpage and file location URL on the same domain. Example: webpage: https://example.com/viewer/test.html; PDF location: https://example.com/resources/abc.pdf)
- Enable CORS headers on the PDF resource to allow access from your webpage domain.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

