legalthings / angular-pdfjs-viewer

PDF.js viewer directive for AngularJS
MIT License
137 stars 113 forks source link

Error when using grunt build #49

Closed victorfss closed 7 years ago

victorfss commented 7 years ago

When I am using grunt serve the pdfjs viewer works fine, but when I generate the project dist and run does not work, it follows the two prints and the error in console

grunt serve grunt serve

grunt build grunt build

Uncaught ReferenceError: document is not defined Uncaught ReferenceError: document is not defined blob:http://localhost:8080/b803276a-aa61-4f95-8710-1f6a04ac8cb6:1 Warning: Setting up fake worker. scripts.e32ad488.js:formatted:10251 PDF db5d92d2d7ca03a71d959a1208c27b52 [1.4 iTextSharp™ 5.5.5 ©2000-2014 iText Group NV (AGPL-version) / -] (PDF.js: 1.1.215)

I'm using the $scope.data and pass data as a Uint8Array object.

Another error is: PDFViewerApplication.pdfViewer is not set TypeError: Cannot read property 'currentPageNumber' of null

Does anyone know if there is any additional configuration when generating the dist?

jasny commented 7 years ago

Read Advanced configuration in the README.

I recommend making your grunt setup copy the pdf.worker.js and other assets.