1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #13932 from Snuffleupagus/oc-images

Support Optional Content in Image-/XObjects (issue 13931)
This commit is contained in:
Brendan Dahl 2021-08-30 10:10:14 -07:00 committed by GitHub
commit 306119b12a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 58 additions and 9 deletions

View file

@ -519,7 +519,7 @@ var Driver = (function DriverClosure() {
styleElement: xfaStyleElement,
});
loadingTask.promise.then(
doc => {
async doc => {
if (task.enableXfa) {
task.fontRules = "";
for (const rule of xfaStyleElement.sheet.cssRules) {
@ -531,6 +531,15 @@ var Driver = (function DriverClosure() {
task.optionalContentConfigPromise =
doc.getOptionalContentConfig();
if (task.optionalContent) {
const entries = Object.entries(task.optionalContent),
optionalContentConfig =
await task.optionalContentConfigPromise;
for (const [id, visible] of entries) {
optionalContentConfig.setVisibility(id, visible);
}
}
this._nextPage(task, failure);
},
err => {

View file

@ -442,6 +442,7 @@
!issue8097_reduced.pdf
!quadpoints.pdf
!transparent.pdf
!issue13931.pdf
!xobject-image.pdf
!issue6605.pdf
!ccitt_EndOfBlock_false.pdf

BIN
test/pdfs/issue13931.pdf Normal file

Binary file not shown.

View file

@ -5019,6 +5019,21 @@
"rounds": 1,
"type": "eq"
},
{ "id": "issue13931-default",
"file": "pdfs/issue13931.pdf",
"md5": "799d5025787115d22863ae23a3042491",
"rounds": 1,
"type": "eq"
},
{ "id": "issue13931-hidden",
"file": "pdfs/issue13931.pdf",
"md5": "799d5025787115d22863ae23a3042491",
"rounds": 1,
"type": "eq",
"optionalContent": {
"7R": false
}
},
{ "id": "issue2829",
"file": "pdfs/issue2829.pdf",
"md5": "f32b28cf8792f6ccc470446bfbb38584",