Merge pull request #21414 from calixteman/issue21406

Handle TR2 with /Default entry
This commit is contained in:
Tim van der Meij 2026-06-09 19:26:57 +02:00 committed by GitHub
commit 7f5b42140d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 2 deletions

View File

@ -1205,9 +1205,22 @@ class PartialEvaluator {
}
break;
case "TR":
case "TR2": {
// TR2 takes precedence over TR (see PDF 32000-1:2008, Table 58), so
// ignore TR when a TR2 entry is present in the same dictionary.
if (key === "TR" && gState.has("TR2")) {
break;
}
// For TR2 the name /Default denotes "the transfer function that was
// in effect at the start of the page" (PDF 32000-1:2008, Table 58).
// A page always starts with the identity transfer function, hence
// /Default (and /Identity) means "no transfer function" here, which
// clears any filter previously set on the display side (issue 21406).
// `handleTransferFunction` returns `null` for those names.
const transferMaps = this.handleTransferFunction(value);
gStateObj.push([key, transferMaps]);
gStateObj.push(["TR", transferMaps]);
break;
}
// Only generate info log messages for the following since
// they are unlikely to have a big impact on the rendering.
case "OP":
@ -1217,7 +1230,6 @@ class PartialEvaluator {
case "BG2":
case "UCR":
case "UCR2":
case "TR2":
case "HT":
case "SM":
case "SA":

View File

@ -0,0 +1,2 @@
https://github.com/user-attachments/files/28716910/emptyPage.pdf

View File

@ -14364,5 +14364,13 @@
"md5": "702be2459f9bdbe93338ab3a584babc4",
"rounds": 1,
"type": "eq"
},
{
"id": "issue21406",
"file": "pdfs/issue21406.pdf",
"md5": "d8042e1ee1213e8b0f1f9383d218277f",
"rounds": 1,
"link": true,
"type": "eq"
}
]