diff --git a/examples/components/simpleviewer.js b/examples/components/simpleviewer.js index f064a53be..0ea8e5a38 100644 --- a/examples/components/simpleviewer.js +++ b/examples/components/simpleviewer.js @@ -92,10 +92,11 @@ const loadingTask = pdfjsLib.getDocument({ cMapPacked: CMAP_PACKED, enableXfa: ENABLE_XFA, }); -loadingTask.promise.then(function (pdfDocument) { +(async function () { + const pdfDocument = await loadingTask.promise; // Document loaded, specifying document for the viewer and // the (optional) linkService. pdfViewer.setDocument(pdfDocument); pdfLinkService.setDocument(pdfDocument, null); -}); +})();