sayanee / angularjs-pdf

:page_facing_up: An AngularJS directive <ng-pdf> to display PDF files with PDFJS
http://sayan.ee/angularjs-pdf/
MIT License
494 stars 248 forks source link

Error: No PDFJS.workerSrc specified #199

Closed jenikaur closed 7 years ago

dennybiasiolli commented 7 years ago

Can you provide more info about your error?

jaime-ez commented 7 years ago

Hi, I encountered a similar error. From what I could deduce pdf.js has some issues when calling the worker. For instance if I use pdf.min.js it will look for pdf.min.worker.js (instead of pdf.worker.min.js) and thus a PDFJS.workerSrc error is emitted. This happens also after the build step for my bower deps where all files are uglified and concat into one scripts.FILEREVNUMBER.js file, thus pdf.js will look for pdf.FILEREVNUMBER.worker.js (file not found error) instead of looking in the same file path.

My workaround was to remove pdf.js from bower deps and get it from a cdn (the non minified version). I think angularjs-pdf could benefit from not using pdf.js as a bower dependency and just call it from a cdn, or maybe updating the bower dep to a more recent pdf.js version that probably does not have this issue (haven't looked into it).

Those are my two cents on this issue, hope it helps!

jenikaur commented 7 years ago

Thanks for the help but resolved the issue by including the file for pdfjsworker.

Regards

On Jul 8, 2017 9:42 PM, "jaime echegaray zipper" notifications@github.com wrote:

Hi, I encountered a similar error. For what I could isolate pdf.js has some issues when calling the worker. For instance if I use pdf.min.js it will look for pdf.min.worker.js (instead of pdf.worker.min.js) and thus a PDFJS.workerSrc error is emitted. This happens also after the build step for my bower deps where all files are uglified and concat into one scripts.FILEREVNUMBER.js file, thus pdf.js will look for pdf.FILEREVNUMBER.worker.js (file not found error) instead of looking in the same file path.

My workaround was to remove pdf.js from bower deps and get it from a cdn (the non minified version). I think angularjs-pdf could benefit from not using pdf.js as a bower dependency and just call it from a cdn, or maybe updating the bower dep to a more recent pdf.js version that probably does not have this issue (haven't looked in it).

Those are my two cents on this issue, hope it helps!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sayanee/angularjs-pdf/issues/199#issuecomment-313865290, or mute the thread https://github.com/notifications/unsubscribe-auth/AbH3yvY0BwitVQ-H3hn1jc8B2-6QcW43ks5sL6pfgaJpZM4N8BBp .