Skip to content

Instantly share code, notes, and snippets.

@kmrobin
Last active May 24, 2020 03:46
Show Gist options
  • Save kmrobin/a1db9238f040ced5199ea24b0ecb05ff to your computer and use it in GitHub Desktop.
Save kmrobin/a1db9238f040ced5199ea24b0ecb05ff to your computer and use it in GitHub Desktop.
AEM PDF Viewer Component (JS)
$(document).ready(function() {
document.addEventListener("adobe_dc_view_sdk.ready", initializePDF);
function initializePDF() {
var pdffile = $('#pdffile').val();
var title = $('#title').val();
var viewmode = $('#viewmode').val();
var viewerConfig = {
showAnnotationTools: true,
enableFormFilling: true,
showLeftHandPanel: true,
showDownloadPDF: true,
showPrintPDF: true,
showPageControls: true,
dockPageControls: true,
embedMode: $('#viewmode').val()
};
if (pdffile) {
var adobeDCView = new AdobeDC.View({
clientId: "<YOUR_CLIENT_ID>",
divId: "adobe-dc-view",
reportSuiteId: "<YOUR_ANALYTICS_REPORT_SUITE_ID>"
});
adobeDCView.previewFile({
content: {
location: {
url: pdffile
}
},
metaData: {
fileName: title
}
}, viewerConfig);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment