Question
Please help with JS and PDF Embed API
Hello,
I am creating a button on my html website that when you click it - it opens up a lightbox embedded pdf just like in the Demo .
Here is my code. It doesn't work in safari and when I do the web inspector is says "unable to find variable AcrobatDC" - Please help
<html lang="en">
<head>
<script type="text/javascript" src="https://website.ca/js/index.js"></script>
<script type="text/javascript" src="https://documentcloud.adobe.com/view-sdk/main.js"></script>
</head>
<body>
<div class="Button-Icon-1">
<button id="iconButton" type="button" onclick="previewFileIcon()"><img src="https://website/icons/icon1.png" alt="Icon1">
</button>
</div>const viewerConfig = {
embedMode: "LIGHT_BOX",
defaultViewMode: "FIT_PAGE",
showPageControls: false,
showDownloadPDF: false,
showPrintPDF: false
};
var adobeDCView = document.getElementById("iconButton").onclick = previewFileIcon();
function previewFileTools() {
var adobeDCView = new AdobeDC.View({
clientId: "My-api-key"
});
adobeDCView.previewFile({
content: {
location: {
url: "https://website/documents/Icon.pdf"
}
},
metaData: {
fileName: "Icon.pdf"
}
}, viewerConfig);
}
