New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run PDF.js canvas rendering in a web-worker #10319
Comments
Looks (essentially) like a duplicate of issue #10039; most likely, a fair amount of re-factoring would be required for |
Thanks. @Snuffleupagus I saw that issue, and should've linked it; the problems are not identical in the sense that:
In other words |
Looking at https://github.com/mozilla/pdf.js/blob/master/examples/node/pdf2png/pdf2png.js (a node example), it looks like you may need to make a |
How do you use pdf.js inside a web-worker? I imported it by this.
But when using
|
Duplicate of #10039 |
I finally figured out how to use the OffscreenCanvas in a web worker to render the PDF. In the worker script, we need to use workerPort to set the
we also need to provide a fake ownerDocument, If we don't do that, the PDF can still be rendered, but fonts and figures is incorrect:
It works good in my project. But I'm not sure if this will cause any potential problems. |
Configuration:
Steps to reproduce the problem:
w = new Worker('sample-pdf.js');
What is the expected behavior? (add screenshot)
PDF would render to the
OffscreenCanvas
What went wrong? (add screenshot)
i.e. this is failing:
The problem is the absence of a DOM. The issue might be one of documentation, as PDF.js has a Node example, or there may be issues lurking in the deep. In any case I wanted to report it in case there were some obvious guidelines here.
The text was updated successfully, but these errors were encountered: