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

Add support for optional marked content.

Add a new method to the API to get the optional content configuration. Add
a new render task param that accepts the above configuration.
For now, the optional content is not controllable by the user in
the viewer, but renders with the default configuration in the PDF.

All of the test files added exhibit different uses of optional content.

Fixes #269.

Fix test to work with optional content.

- Change the stopAtErrors test to ensure the operator list has something,
  instead of asserting the exact number of operators.
This commit is contained in:
Brendan Dahl 2020-07-14 15:17:27 -07:00
parent e68ac05f18
commit ac494a2278
14 changed files with 1179 additions and 54 deletions

View file

@ -52,6 +52,7 @@
!issue7835.pdf
!issue11922_reduced.pdf
!issue7855.pdf
!issue11144_reduced.pdf
!issue7872.pdf
!issue7901.pdf
!issue8061.pdf
@ -296,6 +297,7 @@
!issue3371.pdf
!issue2956.pdf
!issue2537r.pdf
!issue269_1.pdf
!bug946506.pdf
!issue3885.pdf
!issue11697_reduced.pdf
@ -331,6 +333,7 @@
!issue5481.pdf
!issue5567.pdf
!issue5701.pdf
!issue12007_reduced.pdf
!issue5896.pdf
!issue6010_1.pdf
!issue6010_2.pdf
@ -352,6 +355,7 @@
!issue9278.pdf
!annotation-text-without-popup.pdf
!annotation-underline.pdf
!issue269_2.pdf
!annotation-strikeout.pdf
!annotation-squiggly.pdf
!annotation-highlight.pdf

Binary file not shown.

Binary file not shown.

676
test/pdfs/issue269_1.pdf Normal file

File diff suppressed because one or more lines are too long

BIN
test/pdfs/issue269_2.pdf Normal file

Binary file not shown.

View file

@ -926,6 +926,34 @@
"link": false,
"type": "eq"
},
{ "id": "issue269_1",
"file": "pdfs/issue269_1.pdf",
"md5": "ab932f697b4d2e2bf700de15a8efea9c",
"rounds": 1,
"type": "eq",
"about": "Optional marked content."
},
{ "id": "issue269_2",
"file": "pdfs/issue269_2.pdf",
"md5": "0f553510850ee17c87fbab3fac564165",
"rounds": 1,
"type": "eq",
"about": "Optional marked content."
},
{ "id": "issue11144_reduced",
"file": "pdfs/issue11144_reduced.pdf",
"md5": "09e3e771ebd6867558074e900adb54b9",
"rounds": 1,
"type": "eq",
"about": "Optional marked content."
},
{ "id": "issue12007_reduced",
"file": "pdfs/issue12007_reduced.pdf",
"md5": "3aa9d8a0c5ff8594245149f9c7379613",
"rounds": 1,
"type": "eq",
"about": "Optional marked content."
},
{ "id": "issue10438",
"file": "pdfs/issue10438_reduced.pdf",
"md5": "bb26f68493e33af17b256a6ffe777a24",

View file

@ -1636,8 +1636,8 @@ describe("api", function () {
const result1 = loadingTask1.promise.then(pdfDoc => {
return pdfDoc.getPage(1).then(pdfPage => {
return pdfPage.getOperatorList().then(opList => {
expect(opList.fnArray.length).toEqual(722);
expect(opList.argsArray.length).toEqual(722);
expect(opList.fnArray.length).toBeGreaterThan(100);
expect(opList.argsArray.length).toBeGreaterThan(100);
expect(opList.lastChunk).toEqual(true);
return loadingTask1.destroy();