Participant
December 7, 2020
Answered
Problems Loading the Embed API on my website.
- December 7, 2020
- 1 reply
- 1416 views
I used this code to embed a pdf viewer on my website, but none of the pdfs I've tried show. I tested with the Document Services PDF Embed API Demo and when I open the file there it opens. However, when I try to use it on the website, it doesn't load. I keep receiving the error "File preview error. File preview not available, please reload to try again."
Here's the code I used
<!--Get the samples from https://www.adobe.com/go/pdfembedapi_samples-->
<!DOCTYPE html>
<html>
<head>
<title>Adobe Document Services PDF Embed API Sample</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body style="margin: 0px">
<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: "5ca60f923d3f430ca29cbdd7fc06a442", divId: "adobe-dc-view"});
adobeDCView.previewFile({
content:{location: {url: "test.pdf"}},
metaData:{fileName: "Test pdf"}
}, {});
});
</script>
</body>
</html>
