Skip to content
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

[Bug]: With dark theme, when pdfjs.forcePageColors is set to true, bright white flashes during page scroll (and other artifacts) #18680

Closed
Gitoffthelawn opened this issue Sep 1, 2024 · 5 comments · Fixed by #18742

Comments

@Gitoffthelawn
Copy link

Attach (recommended) or Link to PDF file

https://cdn.fulltextarchive.com/wp-content/uploads/wp-advanced-pdf/1/The-Red-Badge-of-Couragex6045.pdf
https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf

Web browser and its version

Firefox 129.0.2

Operating system and its version

Linux

PDF.js version

4.4.140

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

  1. In Firefox 129.0.2, set pdfjs.forcePageColors to true in about:config.
  2. Set the dark theme to be the default in Firefox.
  3. Open https://cdn.fulltextarchive.com/wp-content/uploads/wp-advanced-pdf/1/The-Red-Badge-of-Couragex6045.pdf
  4. Scroll through the pages.
  5. Notice that the pages flash bright while as the user scrolls (very bad on slower computers).
  6. Open https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf
  7. Notice the bright white (colour #fff) page borders, even if the user has set pdfjs.pageColorsForeground to a less bright colour.

What is the expected behavior?

No white flashing when scrolling.
No bright white page borders in dark theme.

What went wrong?

Bright white flashing when scrolling.
Bright white page borders in dark theme, even when text foreground colour set to a less bright colour.

Link to a viewer

No response

Additional context

I found the problem and came to fix it. The problem arises from the background-color of the .pdfViewer .page selector being set to rgb(255 255 255) in viewer.css. When I remove that line of code, these issues are fixed.

So I went to the master branch to remove that line from viewer.css and create a pull request to attach to this issue report. But I'm not seeing that line in viewer.css.

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Sep 1, 2024

I found the problem and came to fix it. The problem arises from the background-color of the .pdfViewer .page selector being set to rgb(255 255 255) in viewer.css. When I remove that line of code, these issues are fixed.

Unfortunately just removing that is not a proper solution, since it'd result in other bugs by removing the "outline" for non-rendered pages.

@Gitoffthelawn
Copy link
Author

I found the problem and came to fix it. The problem arises from the background-color of the .pdfViewer .page selector being set to rgb(255 255 255) in viewer.css. When I remove that line of code, these issues are fixed.

Unfortunately just removing that is not a proper solution, since it'd result in other bugs by removing the "outline" for non-rendered pages.

Thanks. Can you provide a link to an example of such a page so I can take a look?

Hopefully someone with more knowledge of pdf.js can provide a working solution.

@calixteman
Copy link
Contributor

Yes it can be a bit annoying for some users to have such flashing thing.
An idea could be just use the same color as the one defined in pdfjs.pageColorsBackground for the page background when the pref pdfjs.forcePageColors is true.
@Snuffleupagus wdyt ?

@Snuffleupagus
Copy link
Collaborator

An idea could be just use the same color as the one defined in pdfjs.pageColorsBackground for the page background when the pref pdfjs.forcePageColors is true.

You mean something like this?
https://github.com/mozilla/pdf.js/compare/master...Snuffleupagus:pdf.js:pageColorsBackground-unloaded-pages?w=1

@calixteman
Copy link
Contributor

You're fast :)
Yes something like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants