Support custom pageColors in the thumbnails (PR 14874)

Currently, when non-standard `pageColors` are specified, the thumbnails will look inconsistent depending on how they're created.
The thumbnails that are created by downsizing the *page* canvases will obviously use the `pageColors` as intended, however the thumbnails which are rendered *directly* will always use the default colors.
This commit is contained in:
Jonas Jenwald 2022-05-26 09:45:05 +02:00
parent 5b02c685d6
commit 9871761949
4 changed files with 52 additions and 12 deletions

View file

@ -269,13 +269,15 @@ class BaseViewer {
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
if (
options.pageColors &&
(!CSS.supports("color", options.pageColors.background) ||
!CSS.supports("color", options.pageColors.foreground))
this.pageColors &&
!(
CSS.supports("color", this.pageColors.background) &&
CSS.supports("color", this.pageColors.foreground)
)
) {
if (options.pageColors.background || options.pageColors.foreground) {
if (this.pageColors.background || this.pageColors.foreground) {
console.warn(
"Ignoring `pageColors`-option, since the browser doesn't support the values used."
"BaseViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used."
);
}
this.pageColors = null;