ابحث في الدعم

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Firefox PDF reader pdfjs.viewerCssTheme option has no effect

more options

So I wanted to read PDFs trough firefox with a dark theme, looked up how to do so online, and people say to change the "about:config" option "pdfjs.viewerCssTheme" to "2" instead of "0", I did that, tried opening a PDF, nothing happend, it was still black text on white backgrounds. Tried closing firefox, reopened the pdf, nothing happened, still white backgrounds. Tried to check if it might have to do with that specific pdf file's config, created my own PDF file from a word document, tried to open it, still white backgrounds. Tried disabling extensions, (which I use four of, UBlock Origin, SponsporBlock, Return Youtube Dislike and Translate this page), didn't work. Tried enabling the option on my laptop, didn't work. Tried a bunch of other stuff and it still won't work. My Firefox version is 109 and I'm using Windows 10 I also don't want to use the console/file edit thing with grayscale(1) invertcolor(1) or whatever it was since it also reverses the colors of images instead of just the backgrounda nd text color.

So I wanted to read PDFs trough firefox with a dark theme, looked up how to do so online, and people say to change the "about:config" option "pdfjs.viewerCssTheme" to "2" instead of "0", I did that, tried opening a PDF, nothing happend, it was still black text on white backgrounds. Tried closing firefox, reopened the pdf, nothing happened, still white backgrounds. Tried to check if it might have to do with that specific pdf file's config, created my own PDF file from a word document, tried to open it, still white backgrounds. Tried disabling extensions, (which I use four of, UBlock Origin, SponsporBlock, Return Youtube Dislike and Translate this page), didn't work. Tried enabling the option on my laptop, didn't work. Tried a bunch of other stuff and it still won't work. My Firefox version is 109 and I'm using Windows 10 I also don't want to use the console/file edit thing with grayscale(1) invertcolor(1) or whatever it was since it also reverses the colors of images instead of just the backgrounda nd text color.

الحل المُختار

Setting pdfjs.viewerCssTheme = 2 only affects the UI part of the viewer including the border around the file area, it doesn't affect the actual PDF file.

There are these pdfjs*(color|theme) prefs to control the page colors and you can try if this works for you.

  • pdfjs.pageColorsBackground Canvas => #000
  • pdfjs.pageColorsForeground CanvasText => #FFF
  • pdfjs.forcePageColors false => true

Displaying a PDF file with a dark background can be quite challenging, especially when colors other than black text on white background are used or images with a dark background are present where you would no longer see a border on the image.

Using a bookmarklet to invert the full page at least ensures everything if still recognizable.

javascript:/*PDF%20-%20filter%20invert*/(function(){var%20L='style_PDFI',S='#viewerContainer>#viewer.pdfViewer>.page{filter:%20invert(100%)}',SS,E=document.querySelector('style[id="'+L+'"]');if(E){SS=E.disabled;E.disabled=(SS==true)?false:true}else{SS=document.createElement('style');SS.setAttribute('type','text/css');SS.id=L;SS.innerHTML=S;document.querySelector('head').appendChild(SS);}})()

Read this answer in context 👍 2

All Replies (4)

more options

Links to where your saying you found those discussions to make those changes so others reading to see what is being mentioned.

more options

الحل المُختار

Setting pdfjs.viewerCssTheme = 2 only affects the UI part of the viewer including the border around the file area, it doesn't affect the actual PDF file.

There are these pdfjs*(color|theme) prefs to control the page colors and you can try if this works for you.

  • pdfjs.pageColorsBackground Canvas => #000
  • pdfjs.pageColorsForeground CanvasText => #FFF
  • pdfjs.forcePageColors false => true

Displaying a PDF file with a dark background can be quite challenging, especially when colors other than black text on white background are used or images with a dark background are present where you would no longer see a border on the image.

Using a bookmarklet to invert the full page at least ensures everything if still recognizable.

javascript:/*PDF%20-%20filter%20invert*/(function(){var%20L='style_PDFI',S='#viewerContainer>#viewer.pdfViewer>.page{filter:%20invert(100%)}',SS,E=document.querySelector('style[id="'+L+'"]');if(E){SS=E.disabled;E.disabled=(SS==true)?false:true}else{SS=document.createElement('style');SS.setAttribute('type','text/css');SS.id=L;SS.innerHTML=S;document.querySelector('head').appendChild(SS);}})()

more options

Does this work for you since you marked my reply as helpful?

more options

Sorry for my late reply, I just read it after coming back from work, yes it does, thank you!