Document Services API - PDF Embed API Not loading automatically without manual page reload
Hi, I'm new to Document Services API - PDF Embed API and need some assistance, i have a web application that renders html as below, as you can see i have included the below code to embed a pdf using Document Services API, when i execute my web application workflow, after the below code is executed, the browser url changes to http://localhost:8080/qapps/hm/ViewPrintPdf?showPrintPDF=false&filename=20220803165218133_2022-09-28+18%3A06%3A51.pdf and the PDF renders automatically the very first time and the page is rendered [as expected], however on subsequent execution of my webapplication workflow the browser url changes correctly to http://localhost:8080/qapps/hm/ViewPrintPdf?showPrintPDF=false&filename=20220803165218133_2022-09-28+18%3A06%3A51.pdf however the browser does not render the pdf automatically unless i reload the page manually using browser reload button or Ctrl+R, but when i reload the page the pdf is rendered correctly, but when i restart by webapplication server, again the automatic rendering happens for the very first time and the subsequent times i need to manually reload the browser page to display the pdf, Appreciate any pointers to fix this issue
<html><body>
<div id="adobe-dc-view"></div>
<script src="https://documentcloud.adobe.com/view-sdk/viewer.js"></script>
<script type="text/javascript">
// Store the UI options in a constant
const previewConfig = {
showDownloadPDF: false,
showPageControls: true, //showPageControls needs to be true when showZoomControl: true
showZoomControl: true,
showAnnotationTools: false,
embedMode: "FULL_WINDOW", // embedMode includes LIGHT_BOX, FULL_WINDOW
showPrintPDF: ${showPrintPDF}
}
const saveOptions = {
autoSaveFrequency: 0,
enableFocusPolling: false,
showSaveButton: false
}
document.addEventListener("adobe_dc_view_sdk.ready", function () {
var adobeDCView = new AdobeDC.View({clientId: "40f5598045e64160babc289e96b45054", divId: "adobe-dc-view"});
// Consume previewConfig here. . .
adobeDCView.previewFile({
content:{location: {url: "https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf"}},
metaData:{fileName: "Bodea Brochure.pdf"},
}, previewConfig);
adobeDCView.registerCallback(
AdobeDC.View.Enum.CallbackType.SAVE_API,
function(metaData, content, options) {
/* Add your custom save implementation here...and based on that resolve or reject response in given format */
return new Promise((resolve, reject) => {
resolve({
code: AdobeDC.View.Enum.ApiResponseCode.SUCCESS,
data: {
/* Updated file metadata after successful save operation */
metaData: {fileName: "${filename}"}
}
});
});
},
saveOptions);
});
////window.location.reload();
////window.history.forward();
showPDF('http://localhost:8080/hmstatic/pdf/20220803165218133_2022-09-13 18:56:34.pdf');
</script>
</body></html>
