You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In summary, I'm trying the Acroform example. I'm trying to view a pdf hosted on my server but it is giving me the error: Uncaught (in promise) ReferenceError: pdfjsViewer is not defined
Attach (recommended) or Link to PDF file here: The file is hosted on my server.
Configuration:
Web browser and its version: Google Chrome Version 72.0.3626.96 (Official Build) (64-bit)
Operating system and its version: Windows 10
PDF.js version: v2.1.245
Is a browser extension: no
I'm getting the error at var pdfPageView = new pdfjsViewer.PDFPageView({
The code is as below:
pdfjsLib.GlobalWorkerOptions.workerSrc = "/js/Lib/pdf.worker.js";
var DEFAULT_SCALE = 1.0;
var container = document.getElementById('viewer_container');
var loadingTask = pdfjsLib.getDocument(pathStringer);
loadingTask.promise.then(function (doc) {
// Use a promise to fetch and render the next page.
var promise = Promise.resolve();
for (var i = 1; i <= doc.numPages; i++) {
promise = promise.then(function (pageNum) {
return doc.getPage(pageNum).then(function (pdfPage) {
// Create the page view.
var pdfPageView = new pdfjsViewer.PDFPageView({
container: container,
id: pageNum,
scale: DEFAULT_SCALE,
defaultViewport: pdfPage.getViewport({ scale: DEFAULT_SCALE, }),
annotationLayerFactory:
new pdfjsViewer.DefaultAnnotationLayerFactory(),
renderInteractiveForms: true,
});
// Associate the actual page with the view and draw it.
pdfPageView.setPdfPage(pdfPage);
return pdfPageView.draw();
});
}.bind(null, i));
}
});
The text was updated successfully, but these errors were encountered:
My bad. Instead of using the viewer from pdfjs-dist which is located at pdf.js\node_modules\pdfjs-dist\web\pdf_viewer.js , I was using viewer at pdf.js\web\viewer.js.
In summary, I'm trying the Acroform example. I'm trying to view a pdf hosted on my server but it is giving me the error: Uncaught (in promise) ReferenceError: pdfjsViewer is not defined
Attach (recommended) or Link to PDF file here: The file is hosted on my server.
Configuration:
I'm getting the error at var pdfPageView = new pdfjsViewer.PDFPageView({
The code is as below:
The text was updated successfully, but these errors were encountered: