Created
November 28, 2021 13:48
-
-
Save FrancescoBonizzi/e0c2313806170ef32b62fde2a2fc2d39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
document.addEventListener('DOMContentLoaded', function () { | |
const errorContainer = document.getElementById('error'); | |
const pdfViewerContainer = document.getElementById('pages-container'); | |
const loader = document.getElementById('loader'); | |
const pdfFileUrl = "sample-pdf-with-images.pdf"; | |
renderPdf( | |
url = pdfFileUrl, | |
onPdfLoaded = () => loader.classList.add('hidden-with-animation'), | |
onError = error => { | |
loader.style.display = 'none'; | |
console.error(error); | |
errorContainer.style.display = 'block'; | |
pdfViewerContainer.style.display = 'none'; | |
errorContainer.innerText = error.message; | |
}); | |
}, false); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment