-
-
Notifications
You must be signed in to change notification settings - Fork 880
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
Fix rendering broken on some browsers #1207
Conversation
Nice, maybe we could do a browser check? Chrome and Edge have the problem, Firefox doesn't. |
If merged, could this also be merged into the v5 branch? |
I tested it, seems to work! |
Workaround till merge: Use https://www.npmjs.com/package/patch-package EDIT: See #1207 (comment)
|
Hi sorry to spam all threads @DonikaV & @1Jesper1; I got a dev to add this change to one of our test environments and I gave it a try. This MR fixed some documents, but not all. I created a bunch of text documents with various fonts and converted to PDF, those are all now fixed - however many of the PDFs that clients are using are still seeing the issue. Seems if there's a lot of images on page it will render with the issue, but it's difficult to find the exact trigger... Here are some sample documents that were fixed with these changes: And here's some sample documents where the issue persists after the changes were applied: Also I have this file, where the top rendered better with the fix but the bottom still has the issue: |
@callabr1 Thanks for testing, interesting to see the change does not fix all problems. Let's hope the canvas bug in Chrome will be fixed soon! |
@wojtekmaj could you please check this PR and merge? Thanks. |
mozilla/pdf.js#14641 (comment) Maybe we need to also add |
What worries me is that with HW acceleration on some users already have performance issues, and by forcing software rendering on all users we will increase the problem. Perhaps we could make it into a flag 🤔 |
I also don't understand why PDF.js itself doesn't use that option. It does, however, use |
@wojtekmaj This is the info for the alpha attribute, I don't now if it's relevant.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext |
@wojtekmaj To fix the bug for all our users we now use patch-package on react-pdf and pdfjs-dist to patch all occurrences of |
This is also concerning to me, I've been trying my best to test on all browsers in order to ensure no regressions arise from turning HW acceleration on but if it's dependent on the Graphics Card I only really have 2 or 3 viable setups to test with. I will try my best to regression test, I have a few other QAs with varied machines that can also test, but there's still a risk that fixing this for the specific cards breaks PDF rendering for other cards.
Thanks @1Jesper1 we will try this when we can. I haven't been able to test much this week as we are about to push our last major release of the year, so I don't want to put anything in there that could negatively impact end-users more than the current bug does. |
@1Jesper1 Do you mind sharing the patch doc on pdfjs-dist? Edit: mine looked something like this (using an older version of react-pdf)
|
@Greg-Hitchon |
@wojtekmaj Can you just merge it and publish a new version? it starts to get weird where I have already seen (including myself 7 copies of the same) 🙏🏾 :) |
I'm parking this for now - see #1010 (comment) for reasoning. |
@wojtekmaj Tried with latest 6.2.2 and still having some issues: |
36a36d4
to
e249af6
Compare
744f655
to
5b90b65
Compare
@wojtekmaj +1 |
f5a9fd6
to
9243e45
Compare
fbeabf1
to
240150a
Compare
I'm closing this since the defaults appear to be working for most folks and we now have customRenderer option which enables you to overwrite the entire canvas rendering process anyway, if you really need it. |
Fixes rendering broken on some browsers by adding
willReadFrequently: true
tocanvas.getContext()
Closes #1010
See mozilla/pdf.js#14641 (comment)