Copy link to clipboard
Copied
I have seen many similar posts, but even with much trouble shooting I can't seem to get the PDF embed code to work. Have created multiple API keys, but won't work.
Here is the code I'm using
<html>
<head>
<title>Your title</title>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<script src="http://documentcloud.adobe.com/view-sdk/main.js"></script>
</head>
<body>
<div id="adobe-dc-view"></div>
<script type="text/javascript">
document.addEventListener("adobe_dc_view_sdk.ready", function()
{
var adobeDCView = new AdobeDC.View({clientId: "99546d4b3c424396afeb3522fdd20b62", divId: "adobe-dc-view"});
adobeDCView.previewFile(
{
content: {location: {url: "(http://pccirls.weebly.com/uploads/1/3/5/4/135443943/pdf_test.pdf"}},
metaData: {fileName: " pdf_test.pdf "}
});
});
</script>
</body>
</html>
Your client ID was created with the www prefix but the url you are trying to use Embed API from is not. They have to match.
Copy link to clipboard
Copied
The PDF I can see is viewable online without issue. But yet the embed code doesn't work on the website.
Copy link to clipboard
Copied
Lastly, even when I use the demo code. I still get this error.
<div id="adobe-dc-view" style="height: 360px; width: 500px;"></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: "99546d4b3c424396afeb3522fdd20b62", divId: "adobe-dc-view"});
adobeDCView.previewFile({
content:{location: {url: "https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf"}},
metaData:{fileName: "Bodea Brochure.pdf"}
}, {embedMode: "SIZED_CONTAINER"});
});
</script>
In preview mode
In published mode
Copy link to clipboard
Copied
It just looks like you are not using a proper client ID. Your code works perfectly fine for me with my ID.
Copy link to clipboard
Copied
It looks like it is set up appropriately?
Copy link to clipboard
Copied
I created that Client ID brand new in case there was some issue. And here is the code in text format.
<div id="adobe-dc-view" style="height: 360px; width: 500px;"></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: "ab014f3b7d4b4a6092ee37c37179ab1f", divId: "adobe-dc-view"});
adobeDCView.previewFile({
content:{location: {url: "https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf"}},
metaData:{fileName: "Bodea Brochure.pdf"}
}, {embedMode: "SIZED_CONTAINER"});
});
</script>
Copy link to clipboard
Copied
Your client ID was created with the www prefix but the url you are trying to use Embed API from is not. They have to match.
Copy link to clipboard
Copied
Yes! Thank you! It works!
After I got the source code to work with the test file it was easy to use the code to use my own file.
You are the best.