Commit 13cf35ce2f39780b5ce35fd65be4b0ae44ea989d
1 parent
5f4224f3
Use calledgetallpages and pushedinheritedpageresources
Showing
16 changed files
with
980 additions
and
4 deletions
TODO
| @@ -71,10 +71,6 @@ JSON v2 fixes | @@ -71,10 +71,6 @@ JSON v2 fixes | ||
| 71 | 71 | ||
| 72 | * Rethink QPDF::writeJSON. Maybe provide a simpler overload? | 72 | * Rethink QPDF::writeJSON. Maybe provide a simpler overload? |
| 73 | 73 | ||
| 74 | -* When reading back in, we'll have to call | ||
| 75 | - pushInheritedAttributesToPage or getAllPages based on the values | ||
| 76 | - of the metadata. | ||
| 77 | - | ||
| 78 | * Support json v2 in the C API. At a minimum, write_json, | 74 | * Support json v2 in the C API. At a minimum, write_json, |
| 79 | create_from_json, and update_from_json need to be there and should | 75 | create_from_json, and update_from_json need to be there and should |
| 80 | take the same kinds of functions as the C API for logger. | 76 | take the same kinds of functions as the C API for logger. |
libqpdf/QPDF_json.cc
| @@ -473,6 +473,30 @@ QPDF::JSONReactor::dictionaryItem(std::string const& key, JSON const& value) | @@ -473,6 +473,30 @@ QPDF::JSONReactor::dictionaryItem(std::string const& key, JSON const& value) | ||
| 473 | QTC::TC("qpdf", "QPDF_json bad json version"); | 473 | QTC::TC("qpdf", "QPDF_json bad json version"); |
| 474 | error(value.getStart(), "invalid JSON version (must be 2)"); | 474 | error(value.getStart(), "invalid JSON version (must be 2)"); |
| 475 | } | 475 | } |
| 476 | + } else if (key == "pushedinheritedpageresources") { | ||
| 477 | + bool v; | ||
| 478 | + if (value.getBool(v)) { | ||
| 479 | + if ((!this->must_be_complete) && v) { | ||
| 480 | + this->pdf.pushInheritedAttributesToPage(); | ||
| 481 | + } | ||
| 482 | + } else { | ||
| 483 | + QTC::TC("qpdf", "QPDF_json bad pushedinheritedpageresources"); | ||
| 484 | + error( | ||
| 485 | + value.getStart(), | ||
| 486 | + "pushedinheritedpageresources must be a boolean"); | ||
| 487 | + } | ||
| 488 | + } else if (key == "calledgetallpages") { | ||
| 489 | + bool v; | ||
| 490 | + if (value.getBool(v)) { | ||
| 491 | + if ((!this->must_be_complete) && v) { | ||
| 492 | + this->pdf.getAllPages(); | ||
| 493 | + } | ||
| 494 | + } else { | ||
| 495 | + QTC::TC("qpdf", "QPDF_json bad calledgetallpages"); | ||
| 496 | + error( | ||
| 497 | + value.getStart(), | ||
| 498 | + "calledgetallpages must be a boolean"); | ||
| 499 | + } | ||
| 476 | } else { | 500 | } else { |
| 477 | // ignore unknown keys for forward compatibility and to | 501 | // ignore unknown keys for forward compatibility and to |
| 478 | // skip keys we don't care about like "maxobjectid". | 502 | // skip keys we don't care about like "maxobjectid". |
qpdf/qpdf.testcov
| @@ -672,3 +672,5 @@ QPDF_json qpdf not array 0 | @@ -672,3 +672,5 @@ QPDF_json qpdf not array 0 | ||
| 672 | QPDF_json more than two qpdf elements 0 | 672 | QPDF_json more than two qpdf elements 0 |
| 673 | QPDF_json missing json version 0 | 673 | QPDF_json missing json version 0 |
| 674 | QPDF_json bad json version 0 | 674 | QPDF_json bad json version 0 |
| 675 | +QPDF_json bad calledgetallpages 0 | ||
| 676 | +QPDF_json bad pushedinheritedpageresources 0 |
qpdf/qtest/qpdf-json.test
| @@ -214,5 +214,73 @@ $td->runtest("update-from-json object description", | @@ -214,5 +214,73 @@ $td->runtest("update-from-json object description", | ||
| 214 | {$td->FILE => "test-90.out", $td->EXIT_STATUS => 0}, | 214 | {$td->FILE => "test-90.out", $td->EXIT_STATUS => 0}, |
| 215 | $td->NORMALIZE_NEWLINES); | 215 | $td->NORMALIZE_NEWLINES); |
| 216 | 216 | ||
| 217 | +# Exercise pushedinheritedpageresources and calledgetallpages | ||
| 218 | +$n_tests += 12; | ||
| 219 | +$td->runtest("call getAllPages", | ||
| 220 | + {$td->COMMAND => | ||
| 221 | + "qpdf --json-output duplicate-page-inherited.pdf" . | ||
| 222 | + " --json-key=pages a.json"}, | ||
| 223 | + {$td->FILE => "duplicate-page-inherited.out", | ||
| 224 | + $td->EXIT_STATUS => 3}, | ||
| 225 | + $td->NORMALIZE_NEWLINES); | ||
| 226 | +$td->runtest("check json (1)", | ||
| 227 | + {$td->FILE => "a.json"}, | ||
| 228 | + {$td->FILE => "duplicate-page-inherited-1.json"}, | ||
| 229 | + $td->NORMALIZE_NEWLINES); | ||
| 230 | +$td->runtest("update (1)", | ||
| 231 | + {$td->COMMAND => | ||
| 232 | + "qpdf" . | ||
| 233 | + " --update-from-json=duplicate-page-inherited-update.json" . | ||
| 234 | + " --json-output duplicate-page-inherited.pdf" . | ||
| 235 | + " a.json"}, | ||
| 236 | + {$td->FILE => "duplicate-page-inherited.out", | ||
| 237 | + $td->EXIT_STATUS => 3}, | ||
| 238 | + $td->NORMALIZE_NEWLINES); | ||
| 239 | +$td->runtest("check json (2)", | ||
| 240 | + {$td->FILE => "a.json"}, | ||
| 241 | + {$td->FILE => "duplicate-page-inherited-1-fixed.json"}, | ||
| 242 | + $td->NORMALIZE_NEWLINES); | ||
| 243 | +$td->runtest("create PDF (1)", | ||
| 244 | + {$td->COMMAND => | ||
| 245 | + "qpdf --qdf --static-id --json-input a.json a.pdf"}, | ||
| 246 | + {$td->STRING => "", $td->EXIT_STATUS => 0}, | ||
| 247 | + $td->NORMALIZE_NEWLINES); | ||
| 248 | +$td->runtest("check PDF (1)", | ||
| 249 | + {$td->FILE => "a.pdf"}, | ||
| 250 | + {$td->FILE => "duplicate-page-inherited-1-fixed.pdf"}); | ||
| 251 | + | ||
| 252 | +$td->runtest("call pushInheritedAttributesToPage", | ||
| 253 | + {$td->COMMAND => | ||
| 254 | + "qpdf --json-output duplicate-page-inherited.pdf" . | ||
| 255 | + " --json-key=pages --pages . -- a.json"}, | ||
| 256 | + {$td->FILE => "duplicate-page-inherited.out", | ||
| 257 | + $td->EXIT_STATUS => 3}, | ||
| 258 | + $td->NORMALIZE_NEWLINES); | ||
| 259 | +$td->runtest("check json (2)", | ||
| 260 | + {$td->FILE => "a.json"}, | ||
| 261 | + {$td->FILE => "duplicate-page-inherited-2.json"}, | ||
| 262 | + $td->NORMALIZE_NEWLINES); | ||
| 263 | +$td->runtest("update (2)", | ||
| 264 | + {$td->COMMAND => | ||
| 265 | + "qpdf" . | ||
| 266 | + " --update-from-json=duplicate-page-inherited-update2.json" . | ||
| 267 | + " --json-output duplicate-page-inherited.pdf" . | ||
| 268 | + " a.json"}, | ||
| 269 | + {$td->FILE => "duplicate-page-inherited.out", | ||
| 270 | + $td->EXIT_STATUS => 3}, | ||
| 271 | + $td->NORMALIZE_NEWLINES); | ||
| 272 | +$td->runtest("check json (3)", | ||
| 273 | + {$td->FILE => "a.json"}, | ||
| 274 | + {$td->FILE => "duplicate-page-inherited-2-fixed.json"}, | ||
| 275 | + $td->NORMALIZE_NEWLINES); | ||
| 276 | +$td->runtest("create PDF (2)", | ||
| 277 | + {$td->COMMAND => | ||
| 278 | + "qpdf --qdf --static-id --json-input a.json a.pdf"}, | ||
| 279 | + {$td->STRING => "", $td->EXIT_STATUS => 0}, | ||
| 280 | + $td->NORMALIZE_NEWLINES); | ||
| 281 | +$td->runtest("check PDF (2)", | ||
| 282 | + {$td->FILE => "a.pdf"}, | ||
| 283 | + {$td->FILE => "duplicate-page-inherited-2-fixed.pdf"}); | ||
| 284 | + | ||
| 217 | cleanup(); | 285 | cleanup(); |
| 218 | $td->report($n_tests); | 286 | $td->report($n_tests); |
qpdf/qtest/qpdf/duplicate-page-inherited-1-fixed.json
0 โ 100644
| 1 | +{ | ||
| 2 | + "qpdf": [ | ||
| 3 | + { | ||
| 4 | + "jsonversion": 2, | ||
| 5 | + "pdfversion": "1.3", | ||
| 6 | + "pushedinheritedpageresources": false, | ||
| 7 | + "calledgetallpages": true, | ||
| 8 | + "maxobjectid": 8 | ||
| 9 | + }, | ||
| 10 | + { | ||
| 11 | + "obj:1 0 R": { | ||
| 12 | + "value": { | ||
| 13 | + "/Pages": "2 0 R", | ||
| 14 | + "/Type": "/Catalog" | ||
| 15 | + } | ||
| 16 | + }, | ||
| 17 | + "obj:2 0 R": { | ||
| 18 | + "value": { | ||
| 19 | + "/Count": 2, | ||
| 20 | + "/Kids": [ | ||
| 21 | + "3 0 R" | ||
| 22 | + ], | ||
| 23 | + "/Resources": { | ||
| 24 | + "/Font": { | ||
| 25 | + "/F1": "6 0 R" | ||
| 26 | + } | ||
| 27 | + }, | ||
| 28 | + "/Type": "/Pages" | ||
| 29 | + } | ||
| 30 | + }, | ||
| 31 | + "obj:3 0 R": { | ||
| 32 | + "value": { | ||
| 33 | + "/Count": 2, | ||
| 34 | + "/Kids": [ | ||
| 35 | + "4 0 R", | ||
| 36 | + "7 0 R" | ||
| 37 | + ], | ||
| 38 | + "/Parent": "2 0 R", | ||
| 39 | + "/Type": "/Pages" | ||
| 40 | + } | ||
| 41 | + }, | ||
| 42 | + "obj:4 0 R": { | ||
| 43 | + "value": { | ||
| 44 | + "/Contents": "5 0 R", | ||
| 45 | + "/MediaBox": [ | ||
| 46 | + 0, | ||
| 47 | + 0, | ||
| 48 | + 612, | ||
| 49 | + 792 | ||
| 50 | + ], | ||
| 51 | + "/Parent": "3 0 R", | ||
| 52 | + "/Type": "/Page" | ||
| 53 | + } | ||
| 54 | + }, | ||
| 55 | + "obj:5 0 R": { | ||
| 56 | + "stream": { | ||
| 57 | + "data": "QlQKICAvRjEgMjQgVGYKICA3MiA3MjAgVGQKICAoUG90YXRvKSBUagpFVAo=", | ||
| 58 | + "dict": {} | ||
| 59 | + } | ||
| 60 | + }, | ||
| 61 | + "obj:6 0 R": { | ||
| 62 | + "value": { | ||
| 63 | + "/BaseFont": "/Helvetica", | ||
| 64 | + "/Encoding": "/WinAnsiEncoding", | ||
| 65 | + "/Subtype": "/Type1", | ||
| 66 | + "/Type": "/Font" | ||
| 67 | + } | ||
| 68 | + }, | ||
| 69 | + "obj:7 0 R": { | ||
| 70 | + "value": { | ||
| 71 | + "/Contents": "8 0 R", | ||
| 72 | + "/MediaBox": [ | ||
| 73 | + 0, | ||
| 74 | + 0, | ||
| 75 | + 612, | ||
| 76 | + 792 | ||
| 77 | + ], | ||
| 78 | + "/Parent": "3 0 R", | ||
| 79 | + "/Type": "/Page" | ||
| 80 | + } | ||
| 81 | + }, | ||
| 82 | + "obj:8 0 R": { | ||
| 83 | + "stream": { | ||
| 84 | + "data": "QlQKICAvRjEgMjQgVGYKICA3MiA3MjAgVGQKICAoU2FsYWQpIFRqCkVUCg==", | ||
| 85 | + "dict": {} | ||
| 86 | + } | ||
| 87 | + }, | ||
| 88 | + "trailer": { | ||
| 89 | + "value": { | ||
| 90 | + "/Root": "1 0 R", | ||
| 91 | + "/Size": 7 | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + ] | ||
| 96 | +} |
qpdf/qtest/qpdf/duplicate-page-inherited-1-fixed.pdf
0 โ 100644
| 1 | +%PDF-1.3 | ||
| 2 | +%ยฟรทยขรพ | ||
| 3 | +%QDF-1.0 | ||
| 4 | + | ||
| 5 | +%% Original object ID: 1 0 | ||
| 6 | +1 0 obj | ||
| 7 | +<< | ||
| 8 | + /Pages 2 0 R | ||
| 9 | + /Type /Catalog | ||
| 10 | +>> | ||
| 11 | +endobj | ||
| 12 | + | ||
| 13 | +%% Original object ID: 2 0 | ||
| 14 | +2 0 obj | ||
| 15 | +<< | ||
| 16 | + /Count 2 | ||
| 17 | + /Kids [ | ||
| 18 | + 3 0 R | ||
| 19 | + ] | ||
| 20 | + /Resources << | ||
| 21 | + /Font << | ||
| 22 | + /F1 4 0 R | ||
| 23 | + >> | ||
| 24 | + >> | ||
| 25 | + /Type /Pages | ||
| 26 | +>> | ||
| 27 | +endobj | ||
| 28 | + | ||
| 29 | +%% Original object ID: 3 0 | ||
| 30 | +3 0 obj | ||
| 31 | +<< | ||
| 32 | + /Count 2 | ||
| 33 | + /Kids [ | ||
| 34 | + 5 0 R | ||
| 35 | + 6 0 R | ||
| 36 | + ] | ||
| 37 | + /Parent 2 0 R | ||
| 38 | + /Type /Pages | ||
| 39 | +>> | ||
| 40 | +endobj | ||
| 41 | + | ||
| 42 | +%% Original object ID: 6 0 | ||
| 43 | +4 0 obj | ||
| 44 | +<< | ||
| 45 | + /BaseFont /Helvetica | ||
| 46 | + /Encoding /WinAnsiEncoding | ||
| 47 | + /Subtype /Type1 | ||
| 48 | + /Type /Font | ||
| 49 | +>> | ||
| 50 | +endobj | ||
| 51 | + | ||
| 52 | +%% Page 1 | ||
| 53 | +%% Original object ID: 4 0 | ||
| 54 | +5 0 obj | ||
| 55 | +<< | ||
| 56 | + /Contents 7 0 R | ||
| 57 | + /MediaBox [ | ||
| 58 | + 0 | ||
| 59 | + 0 | ||
| 60 | + 612 | ||
| 61 | + 792 | ||
| 62 | + ] | ||
| 63 | + /Parent 3 0 R | ||
| 64 | + /Type /Page | ||
| 65 | +>> | ||
| 66 | +endobj | ||
| 67 | + | ||
| 68 | +%% Page 2 | ||
| 69 | +%% Original object ID: 7 0 | ||
| 70 | +6 0 obj | ||
| 71 | +<< | ||
| 72 | + /Contents 9 0 R | ||
| 73 | + /MediaBox [ | ||
| 74 | + 0 | ||
| 75 | + 0 | ||
| 76 | + 612 | ||
| 77 | + 792 | ||
| 78 | + ] | ||
| 79 | + /Parent 3 0 R | ||
| 80 | + /Type /Page | ||
| 81 | +>> | ||
| 82 | +endobj | ||
| 83 | + | ||
| 84 | +%% Contents for page 1 | ||
| 85 | +%% Original object ID: 5 0 | ||
| 86 | +7 0 obj | ||
| 87 | +<< | ||
| 88 | + /Length 8 0 R | ||
| 89 | +>> | ||
| 90 | +stream | ||
| 91 | +BT | ||
| 92 | + /F1 24 Tf | ||
| 93 | + 72 720 Td | ||
| 94 | + (Potato) Tj | ||
| 95 | +ET | ||
| 96 | +endstream | ||
| 97 | +endobj | ||
| 98 | + | ||
| 99 | +8 0 obj | ||
| 100 | +44 | ||
| 101 | +endobj | ||
| 102 | + | ||
| 103 | +%% Contents for page 2 | ||
| 104 | +%% Original object ID: 8 0 | ||
| 105 | +9 0 obj | ||
| 106 | +<< | ||
| 107 | + /Length 10 0 R | ||
| 108 | +>> | ||
| 109 | +stream | ||
| 110 | +BT | ||
| 111 | + /F1 24 Tf | ||
| 112 | + 72 720 Td | ||
| 113 | + (Salad) Tj | ||
| 114 | +ET | ||
| 115 | +endstream | ||
| 116 | +endobj | ||
| 117 | + | ||
| 118 | +10 0 obj | ||
| 119 | +43 | ||
| 120 | +endobj | ||
| 121 | + | ||
| 122 | +xref | ||
| 123 | +0 11 | ||
| 124 | +0000000000 65535 f | ||
| 125 | +0000000052 00000 n | ||
| 126 | +0000000133 00000 n | ||
| 127 | +0000000289 00000 n | ||
| 128 | +0000000414 00000 n | ||
| 129 | +0000000557 00000 n | ||
| 130 | +0000000710 00000 n | ||
| 131 | +0000000876 00000 n | ||
| 132 | +0000000975 00000 n | ||
| 133 | +0000001044 00000 n | ||
| 134 | +0000001143 00000 n | ||
| 135 | +trailer << | ||
| 136 | + /Root 1 0 R | ||
| 137 | + /Size 11 | ||
| 138 | + /ID [<31415926535897932384626433832795><31415926535897932384626433832795>] | ||
| 139 | +>> | ||
| 140 | +startxref | ||
| 141 | +1163 | ||
| 142 | +%%EOF |
qpdf/qtest/qpdf/duplicate-page-inherited-1.json
0 โ 100644
| 1 | +{ | ||
| 2 | + "pages": [ | ||
| 3 | + { | ||
| 4 | + "contents": [ | ||
| 5 | + "5 0 R" | ||
| 6 | + ], | ||
| 7 | + "images": [], | ||
| 8 | + "label": null, | ||
| 9 | + "object": "4 0 R", | ||
| 10 | + "outlines": [], | ||
| 11 | + "pageposfrom1": 1 | ||
| 12 | + }, | ||
| 13 | + { | ||
| 14 | + "contents": [ | ||
| 15 | + "5 0 R" | ||
| 16 | + ], | ||
| 17 | + "images": [], | ||
| 18 | + "label": null, | ||
| 19 | + "object": "7 0 R", | ||
| 20 | + "outlines": [], | ||
| 21 | + "pageposfrom1": 2 | ||
| 22 | + } | ||
| 23 | + ], | ||
| 24 | + "qpdf": [ | ||
| 25 | + { | ||
| 26 | + "jsonversion": 2, | ||
| 27 | + "pdfversion": "1.3", | ||
| 28 | + "pushedinheritedpageresources": false, | ||
| 29 | + "calledgetallpages": true, | ||
| 30 | + "maxobjectid": 7 | ||
| 31 | + }, | ||
| 32 | + { | ||
| 33 | + "obj:1 0 R": { | ||
| 34 | + "value": { | ||
| 35 | + "/Pages": "2 0 R", | ||
| 36 | + "/Type": "/Catalog" | ||
| 37 | + } | ||
| 38 | + }, | ||
| 39 | + "obj:2 0 R": { | ||
| 40 | + "value": { | ||
| 41 | + "/Count": 2, | ||
| 42 | + "/Kids": [ | ||
| 43 | + "3 0 R" | ||
| 44 | + ], | ||
| 45 | + "/Resources": { | ||
| 46 | + "/Font": { | ||
| 47 | + "/F1": "6 0 R" | ||
| 48 | + } | ||
| 49 | + }, | ||
| 50 | + "/Type": "/Pages" | ||
| 51 | + } | ||
| 52 | + }, | ||
| 53 | + "obj:3 0 R": { | ||
| 54 | + "value": { | ||
| 55 | + "/Count": 2, | ||
| 56 | + "/Kids": [ | ||
| 57 | + "4 0 R", | ||
| 58 | + "7 0 R" | ||
| 59 | + ], | ||
| 60 | + "/Parent": "2 0 R", | ||
| 61 | + "/Type": "/Pages" | ||
| 62 | + } | ||
| 63 | + }, | ||
| 64 | + "obj:4 0 R": { | ||
| 65 | + "value": { | ||
| 66 | + "/Contents": "5 0 R", | ||
| 67 | + "/MediaBox": [ | ||
| 68 | + 0, | ||
| 69 | + 0, | ||
| 70 | + 612, | ||
| 71 | + 792 | ||
| 72 | + ], | ||
| 73 | + "/Parent": "3 0 R", | ||
| 74 | + "/Type": "/Page" | ||
| 75 | + } | ||
| 76 | + }, | ||
| 77 | + "obj:5 0 R": { | ||
| 78 | + "stream": { | ||
| 79 | + "data": "QlQKICAvRjEgMjQgVGYKICA3MiA3MjAgVGQKICAoUG90YXRvKSBUagpFVAo=", | ||
| 80 | + "dict": {} | ||
| 81 | + } | ||
| 82 | + }, | ||
| 83 | + "obj:6 0 R": { | ||
| 84 | + "value": { | ||
| 85 | + "/BaseFont": "/Helvetica", | ||
| 86 | + "/Encoding": "/WinAnsiEncoding", | ||
| 87 | + "/Subtype": "/Type1", | ||
| 88 | + "/Type": "/Font" | ||
| 89 | + } | ||
| 90 | + }, | ||
| 91 | + "obj:7 0 R": { | ||
| 92 | + "value": { | ||
| 93 | + "/Contents": "5 0 R", | ||
| 94 | + "/MediaBox": [ | ||
| 95 | + 0, | ||
| 96 | + 0, | ||
| 97 | + 612, | ||
| 98 | + 792 | ||
| 99 | + ], | ||
| 100 | + "/Parent": "3 0 R", | ||
| 101 | + "/Type": "/Page" | ||
| 102 | + } | ||
| 103 | + }, | ||
| 104 | + "trailer": { | ||
| 105 | + "value": { | ||
| 106 | + "/Root": "1 0 R", | ||
| 107 | + "/Size": 7 | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + ] | ||
| 112 | +} |
qpdf/qtest/qpdf/duplicate-page-inherited-2-fixed.json
0 โ 100644
| 1 | +{ | ||
| 2 | + "qpdf": [ | ||
| 3 | + { | ||
| 4 | + "jsonversion": 2, | ||
| 5 | + "pdfversion": "1.3", | ||
| 6 | + "pushedinheritedpageresources": true, | ||
| 7 | + "calledgetallpages": true, | ||
| 8 | + "maxobjectid": 9 | ||
| 9 | + }, | ||
| 10 | + { | ||
| 11 | + "obj:1 0 R": { | ||
| 12 | + "value": { | ||
| 13 | + "/Pages": "2 0 R", | ||
| 14 | + "/Type": "/Catalog" | ||
| 15 | + } | ||
| 16 | + }, | ||
| 17 | + "obj:2 0 R": { | ||
| 18 | + "value": { | ||
| 19 | + "/Count": 2, | ||
| 20 | + "/Kids": [ | ||
| 21 | + "3 0 R" | ||
| 22 | + ], | ||
| 23 | + "/Type": "/Pages" | ||
| 24 | + } | ||
| 25 | + }, | ||
| 26 | + "obj:3 0 R": { | ||
| 27 | + "value": { | ||
| 28 | + "/Count": 2, | ||
| 29 | + "/Kids": [ | ||
| 30 | + "4 0 R", | ||
| 31 | + "7 0 R" | ||
| 32 | + ], | ||
| 33 | + "/Parent": "2 0 R", | ||
| 34 | + "/Type": "/Pages" | ||
| 35 | + } | ||
| 36 | + }, | ||
| 37 | + "obj:4 0 R": { | ||
| 38 | + "value": { | ||
| 39 | + "/Contents": "5 0 R", | ||
| 40 | + "/MediaBox": [ | ||
| 41 | + 0, | ||
| 42 | + 0, | ||
| 43 | + 612, | ||
| 44 | + 792 | ||
| 45 | + ], | ||
| 46 | + "/Parent": "3 0 R", | ||
| 47 | + "/Resources": "8 0 R", | ||
| 48 | + "/Type": "/Page" | ||
| 49 | + } | ||
| 50 | + }, | ||
| 51 | + "obj:5 0 R": { | ||
| 52 | + "stream": { | ||
| 53 | + "data": "QlQKICAvRjEgMjQgVGYKICA3MiA3MjAgVGQKICAoUG90YXRvKSBUagpFVAo=", | ||
| 54 | + "dict": {} | ||
| 55 | + } | ||
| 56 | + }, | ||
| 57 | + "obj:6 0 R": { | ||
| 58 | + "value": { | ||
| 59 | + "/BaseFont": "/Helvetica", | ||
| 60 | + "/Encoding": "/WinAnsiEncoding", | ||
| 61 | + "/Subtype": "/Type1", | ||
| 62 | + "/Type": "/Font" | ||
| 63 | + } | ||
| 64 | + }, | ||
| 65 | + "obj:7 0 R": { | ||
| 66 | + "value": { | ||
| 67 | + "/Contents": "9 0 R", | ||
| 68 | + "/MediaBox": [ | ||
| 69 | + 0, | ||
| 70 | + 0, | ||
| 71 | + 612, | ||
| 72 | + 792 | ||
| 73 | + ], | ||
| 74 | + "/Parent": "2 0 R", | ||
| 75 | + "/Resources": { | ||
| 76 | + "/Font": { | ||
| 77 | + "/F2": "6 0 R" | ||
| 78 | + } | ||
| 79 | + }, | ||
| 80 | + "/Type": "/Page" | ||
| 81 | + } | ||
| 82 | + }, | ||
| 83 | + "obj:8 0 R": { | ||
| 84 | + "value": { | ||
| 85 | + "/Font": { | ||
| 86 | + "/F1": "6 0 R" | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + }, | ||
| 90 | + "obj:9 0 R": { | ||
| 91 | + "stream": { | ||
| 92 | + "data": "QlQKICAvRjIgMjQgVGYKICA3MiA3MjAgVGQKICAoU2FsYWQpIFRqCkVUCg==", | ||
| 93 | + "dict": {} | ||
| 94 | + } | ||
| 95 | + }, | ||
| 96 | + "trailer": { | ||
| 97 | + "value": { | ||
| 98 | + "/Root": "1 0 R", | ||
| 99 | + "/Size": 7 | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + ] | ||
| 104 | +} |
qpdf/qtest/qpdf/duplicate-page-inherited-2-fixed.pdf
0 โ 100644
| 1 | +%PDF-1.3 | ||
| 2 | +%ยฟรทยขรพ | ||
| 3 | +%QDF-1.0 | ||
| 4 | + | ||
| 5 | +%% Original object ID: 1 0 | ||
| 6 | +1 0 obj | ||
| 7 | +<< | ||
| 8 | + /Pages 2 0 R | ||
| 9 | + /Type /Catalog | ||
| 10 | +>> | ||
| 11 | +endobj | ||
| 12 | + | ||
| 13 | +%% Original object ID: 2 0 | ||
| 14 | +2 0 obj | ||
| 15 | +<< | ||
| 16 | + /Count 2 | ||
| 17 | + /Kids [ | ||
| 18 | + 3 0 R | ||
| 19 | + ] | ||
| 20 | + /Type /Pages | ||
| 21 | +>> | ||
| 22 | +endobj | ||
| 23 | + | ||
| 24 | +%% Original object ID: 3 0 | ||
| 25 | +3 0 obj | ||
| 26 | +<< | ||
| 27 | + /Count 2 | ||
| 28 | + /Kids [ | ||
| 29 | + 4 0 R | ||
| 30 | + 5 0 R | ||
| 31 | + ] | ||
| 32 | + /Parent 2 0 R | ||
| 33 | + /Type /Pages | ||
| 34 | +>> | ||
| 35 | +endobj | ||
| 36 | + | ||
| 37 | +%% Page 1 | ||
| 38 | +%% Original object ID: 4 0 | ||
| 39 | +4 0 obj | ||
| 40 | +<< | ||
| 41 | + /Contents 6 0 R | ||
| 42 | + /MediaBox [ | ||
| 43 | + 0 | ||
| 44 | + 0 | ||
| 45 | + 612 | ||
| 46 | + 792 | ||
| 47 | + ] | ||
| 48 | + /Parent 3 0 R | ||
| 49 | + /Resources 8 0 R | ||
| 50 | + /Type /Page | ||
| 51 | +>> | ||
| 52 | +endobj | ||
| 53 | + | ||
| 54 | +%% Page 2 | ||
| 55 | +%% Original object ID: 7 0 | ||
| 56 | +5 0 obj | ||
| 57 | +<< | ||
| 58 | + /Contents 9 0 R | ||
| 59 | + /MediaBox [ | ||
| 60 | + 0 | ||
| 61 | + 0 | ||
| 62 | + 612 | ||
| 63 | + 792 | ||
| 64 | + ] | ||
| 65 | + /Parent 2 0 R | ||
| 66 | + /Resources << | ||
| 67 | + /Font << | ||
| 68 | + /F2 11 0 R | ||
| 69 | + >> | ||
| 70 | + >> | ||
| 71 | + /Type /Page | ||
| 72 | +>> | ||
| 73 | +endobj | ||
| 74 | + | ||
| 75 | +%% Contents for page 1 | ||
| 76 | +%% Original object ID: 5 0 | ||
| 77 | +6 0 obj | ||
| 78 | +<< | ||
| 79 | + /Length 7 0 R | ||
| 80 | +>> | ||
| 81 | +stream | ||
| 82 | +BT | ||
| 83 | + /F1 24 Tf | ||
| 84 | + 72 720 Td | ||
| 85 | + (Potato) Tj | ||
| 86 | +ET | ||
| 87 | +endstream | ||
| 88 | +endobj | ||
| 89 | + | ||
| 90 | +7 0 obj | ||
| 91 | +44 | ||
| 92 | +endobj | ||
| 93 | + | ||
| 94 | +%% Original object ID: 8 0 | ||
| 95 | +8 0 obj | ||
| 96 | +<< | ||
| 97 | + /Font << | ||
| 98 | + /F1 11 0 R | ||
| 99 | + >> | ||
| 100 | +>> | ||
| 101 | +endobj | ||
| 102 | + | ||
| 103 | +%% Contents for page 2 | ||
| 104 | +%% Original object ID: 9 0 | ||
| 105 | +9 0 obj | ||
| 106 | +<< | ||
| 107 | + /Length 10 0 R | ||
| 108 | +>> | ||
| 109 | +stream | ||
| 110 | +BT | ||
| 111 | + /F2 24 Tf | ||
| 112 | + 72 720 Td | ||
| 113 | + (Salad) Tj | ||
| 114 | +ET | ||
| 115 | +endstream | ||
| 116 | +endobj | ||
| 117 | + | ||
| 118 | +10 0 obj | ||
| 119 | +43 | ||
| 120 | +endobj | ||
| 121 | + | ||
| 122 | +%% Original object ID: 6 0 | ||
| 123 | +11 0 obj | ||
| 124 | +<< | ||
| 125 | + /BaseFont /Helvetica | ||
| 126 | + /Encoding /WinAnsiEncoding | ||
| 127 | + /Subtype /Type1 | ||
| 128 | + /Type /Font | ||
| 129 | +>> | ||
| 130 | +endobj | ||
| 131 | + | ||
| 132 | +xref | ||
| 133 | +0 12 | ||
| 134 | +0000000000 65535 f | ||
| 135 | +0000000052 00000 n | ||
| 136 | +0000000133 00000 n | ||
| 137 | +0000000232 00000 n | ||
| 138 | +0000000367 00000 n | ||
| 139 | +0000000539 00000 n | ||
| 140 | +0000000763 00000 n | ||
| 141 | +0000000862 00000 n | ||
| 142 | +0000000908 00000 n | ||
| 143 | +0000001011 00000 n | ||
| 144 | +0000001110 00000 n | ||
| 145 | +0000001157 00000 n | ||
| 146 | +trailer << | ||
| 147 | + /Root 1 0 R | ||
| 148 | + /Size 12 | ||
| 149 | + /ID [<31415926535897932384626433832795><31415926535897932384626433832795>] | ||
| 150 | +>> | ||
| 151 | +startxref | ||
| 152 | +1264 | ||
| 153 | +%%EOF |
qpdf/qtest/qpdf/duplicate-page-inherited-2.json
0 โ 100644
| 1 | +{ | ||
| 2 | + "pages": [ | ||
| 3 | + { | ||
| 4 | + "contents": [ | ||
| 5 | + "5 0 R" | ||
| 6 | + ], | ||
| 7 | + "images": [], | ||
| 8 | + "label": null, | ||
| 9 | + "object": "4 0 R", | ||
| 10 | + "outlines": [], | ||
| 11 | + "pageposfrom1": 1 | ||
| 12 | + }, | ||
| 13 | + { | ||
| 14 | + "contents": [ | ||
| 15 | + "5 0 R" | ||
| 16 | + ], | ||
| 17 | + "images": [], | ||
| 18 | + "label": null, | ||
| 19 | + "object": "7 0 R", | ||
| 20 | + "outlines": [], | ||
| 21 | + "pageposfrom1": 2 | ||
| 22 | + } | ||
| 23 | + ], | ||
| 24 | + "qpdf": [ | ||
| 25 | + { | ||
| 26 | + "jsonversion": 2, | ||
| 27 | + "pdfversion": "1.3", | ||
| 28 | + "pushedinheritedpageresources": true, | ||
| 29 | + "calledgetallpages": true, | ||
| 30 | + "maxobjectid": 8 | ||
| 31 | + }, | ||
| 32 | + { | ||
| 33 | + "obj:1 0 R": { | ||
| 34 | + "value": { | ||
| 35 | + "/Pages": "2 0 R", | ||
| 36 | + "/Type": "/Catalog" | ||
| 37 | + } | ||
| 38 | + }, | ||
| 39 | + "obj:2 0 R": { | ||
| 40 | + "value": { | ||
| 41 | + "/Count": 2, | ||
| 42 | + "/Kids": [ | ||
| 43 | + "4 0 R", | ||
| 44 | + "7 0 R" | ||
| 45 | + ], | ||
| 46 | + "/Type": "/Pages" | ||
| 47 | + } | ||
| 48 | + }, | ||
| 49 | + "obj:3 0 R": { | ||
| 50 | + "value": { | ||
| 51 | + "/Count": 2, | ||
| 52 | + "/Kids": [ | ||
| 53 | + "4 0 R", | ||
| 54 | + "7 0 R" | ||
| 55 | + ], | ||
| 56 | + "/Parent": "2 0 R", | ||
| 57 | + "/Type": "/Pages" | ||
| 58 | + } | ||
| 59 | + }, | ||
| 60 | + "obj:4 0 R": { | ||
| 61 | + "value": { | ||
| 62 | + "/Contents": "5 0 R", | ||
| 63 | + "/MediaBox": [ | ||
| 64 | + 0, | ||
| 65 | + 0, | ||
| 66 | + 612, | ||
| 67 | + 792 | ||
| 68 | + ], | ||
| 69 | + "/Parent": "2 0 R", | ||
| 70 | + "/Resources": { | ||
| 71 | + "/Font": { | ||
| 72 | + "/F1": "6 0 R" | ||
| 73 | + } | ||
| 74 | + }, | ||
| 75 | + "/Type": "/Page" | ||
| 76 | + } | ||
| 77 | + }, | ||
| 78 | + "obj:5 0 R": { | ||
| 79 | + "stream": { | ||
| 80 | + "data": "QlQKICAvRjEgMjQgVGYKICA3MiA3MjAgVGQKICAoUG90YXRvKSBUagpFVAo=", | ||
| 81 | + "dict": {} | ||
| 82 | + } | ||
| 83 | + }, | ||
| 84 | + "obj:6 0 R": { | ||
| 85 | + "value": { | ||
| 86 | + "/BaseFont": "/Helvetica", | ||
| 87 | + "/Encoding": "/WinAnsiEncoding", | ||
| 88 | + "/Subtype": "/Type1", | ||
| 89 | + "/Type": "/Font" | ||
| 90 | + } | ||
| 91 | + }, | ||
| 92 | + "obj:7 0 R": { | ||
| 93 | + "value": { | ||
| 94 | + "/Contents": "5 0 R", | ||
| 95 | + "/MediaBox": [ | ||
| 96 | + 0, | ||
| 97 | + 0, | ||
| 98 | + 612, | ||
| 99 | + 792 | ||
| 100 | + ], | ||
| 101 | + "/Parent": "2 0 R", | ||
| 102 | + "/Resources": { | ||
| 103 | + "/Font": { | ||
| 104 | + "/F1": "6 0 R" | ||
| 105 | + } | ||
| 106 | + }, | ||
| 107 | + "/Type": "/Page" | ||
| 108 | + } | ||
| 109 | + }, | ||
| 110 | + "obj:8 0 R": { | ||
| 111 | + "value": { | ||
| 112 | + "/Font": { | ||
| 113 | + "/F1": "6 0 R" | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + }, | ||
| 117 | + "trailer": { | ||
| 118 | + "value": { | ||
| 119 | + "/Root": "1 0 R", | ||
| 120 | + "/Size": 7 | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + ] | ||
| 125 | +} |
qpdf/qtest/qpdf/duplicate-page-inherited-update.json
0 โ 100644
| 1 | +{ | ||
| 2 | + "qpdf": [ | ||
| 3 | + { | ||
| 4 | + "jsonversion": 2, | ||
| 5 | + "pushedinheritedpageresources": false, | ||
| 6 | + "calledgetallpages": true, | ||
| 7 | + "maxobjectid": 7 | ||
| 8 | + }, | ||
| 9 | + { | ||
| 10 | + "obj:8 0 R": { | ||
| 11 | + "stream": { | ||
| 12 | + "data": "QlQKICAvRjEgMjQgVGYKICA3MiA3MjAgVGQKICAoU2FsYWQpIFRqCkVUCg==", | ||
| 13 | + "dict": {} | ||
| 14 | + } | ||
| 15 | + }, | ||
| 16 | + "obj:7 0 R": { | ||
| 17 | + "value": { | ||
| 18 | + "/Contents": "8 0 R", | ||
| 19 | + "/MediaBox": [ | ||
| 20 | + 0, | ||
| 21 | + 0, | ||
| 22 | + 612, | ||
| 23 | + 792 | ||
| 24 | + ], | ||
| 25 | + "/Parent": "3 0 R", | ||
| 26 | + "/Type": "/Page" | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | + ] | ||
| 31 | +} |
qpdf/qtest/qpdf/duplicate-page-inherited-update2.json
0 โ 100644
| 1 | +{ | ||
| 2 | + "qpdf": [ | ||
| 3 | + { | ||
| 4 | + "jsonversion": 2, | ||
| 5 | + "pushedinheritedpageresources": true, | ||
| 6 | + "calledgetallpages": true | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "obj:9 0 R": { | ||
| 10 | + "stream": { | ||
| 11 | + "data": "QlQKICAvRjIgMjQgVGYKICA3MiA3MjAgVGQKICAoU2FsYWQpIFRqCkVUCg==", | ||
| 12 | + "dict": {} | ||
| 13 | + } | ||
| 14 | + }, | ||
| 15 | + "obj:7 0 R": { | ||
| 16 | + "value": { | ||
| 17 | + "/Contents": "9 0 R", | ||
| 18 | + "/MediaBox": [ | ||
| 19 | + 0, | ||
| 20 | + 0, | ||
| 21 | + 612, | ||
| 22 | + 792 | ||
| 23 | + ], | ||
| 24 | + "/Parent": "2 0 R", | ||
| 25 | + "/Resources": { | ||
| 26 | + "/Font": { | ||
| 27 | + "/F2": "6 0 R" | ||
| 28 | + } | ||
| 29 | + }, | ||
| 30 | + "/Type": "/Page" | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + ] | ||
| 35 | +} |
qpdf/qtest/qpdf/duplicate-page-inherited.out
0 โ 100644
qpdf/qtest/qpdf/duplicate-page-inherited.pdf
0 โ 100644
| 1 | +%PDF-1.3 | ||
| 2 | +1 0 obj | ||
| 3 | +<< | ||
| 4 | + /Type /Catalog | ||
| 5 | + /Pages 2 0 R | ||
| 6 | +>> | ||
| 7 | +endobj | ||
| 8 | + | ||
| 9 | +2 0 obj | ||
| 10 | +<< | ||
| 11 | + /Type /Pages | ||
| 12 | + /Resources << | ||
| 13 | + /Font << | ||
| 14 | + /F1 6 0 R | ||
| 15 | + >> | ||
| 16 | + >> | ||
| 17 | + /Kids [ | ||
| 18 | + 3 0 R | ||
| 19 | + ] | ||
| 20 | + /Count 2 | ||
| 21 | +>> | ||
| 22 | +endobj | ||
| 23 | + | ||
| 24 | +3 0 obj | ||
| 25 | +<< | ||
| 26 | + /Type /Pages | ||
| 27 | + /Parent 2 0 R | ||
| 28 | + /Kids [ | ||
| 29 | + 4 0 R | ||
| 30 | + 4 0 R | ||
| 31 | + ] | ||
| 32 | + /Count 2 | ||
| 33 | +>> | ||
| 34 | +endobj | ||
| 35 | + | ||
| 36 | +4 0 obj | ||
| 37 | +<< | ||
| 38 | + /Type /Page | ||
| 39 | + /Parent 3 0 R | ||
| 40 | + /MediaBox [0 0 612 792] | ||
| 41 | + /Contents 5 0 R | ||
| 42 | +>> | ||
| 43 | +endobj | ||
| 44 | + | ||
| 45 | +5 0 obj | ||
| 46 | +<< | ||
| 47 | + /Length 44 | ||
| 48 | +>> | ||
| 49 | +stream | ||
| 50 | +BT | ||
| 51 | + /F1 24 Tf | ||
| 52 | + 72 720 Td | ||
| 53 | + (Potato) Tj | ||
| 54 | +ET | ||
| 55 | +endstream | ||
| 56 | +endobj | ||
| 57 | + | ||
| 58 | +6 0 obj | ||
| 59 | +<< | ||
| 60 | + /Type /Font | ||
| 61 | + /Subtype /Type1 | ||
| 62 | + /BaseFont /Helvetica | ||
| 63 | + /Encoding /WinAnsiEncoding | ||
| 64 | +>> | ||
| 65 | +endobj | ||
| 66 | + | ||
| 67 | +xref | ||
| 68 | +0 7 | ||
| 69 | +0000000000 65535 f | ||
| 70 | +0000000009 00000 n | ||
| 71 | +0000000063 00000 n | ||
| 72 | +0000000192 00000 n | ||
| 73 | +0000000290 00000 n | ||
| 74 | +0000000386 00000 n | ||
| 75 | +0000000482 00000 n | ||
| 76 | +trailer << | ||
| 77 | + /Size 7 | ||
| 78 | + /Root 1 0 R | ||
| 79 | +>> | ||
| 80 | +startxref | ||
| 81 | +588 | ||
| 82 | +%%EOF |
qpdf/qtest/qpdf/qjson-bad-pdf-version2.json
qpdf/qtest/qpdf/qjson-bad-pdf-version2.out
| 1 | WARNING: qjson-bad-pdf-version2.json (offset 41): invalid JSON version (must be 2) | 1 | WARNING: qjson-bad-pdf-version2.json (offset 41): invalid JSON version (must be 2) |
| 2 | WARNING: qjson-bad-pdf-version2.json (offset 66): invalid PDF version (must be x.y) | 2 | WARNING: qjson-bad-pdf-version2.json (offset 66): invalid PDF version (must be x.y) |
| 3 | +WARNING: qjson-bad-pdf-version2.json (offset 97): calledgetallpages must be a boolean | ||
| 4 | +WARNING: qjson-bad-pdf-version2.json (offset 138): pushedinheritedpageresources must be a boolean | ||
| 3 | qpdf: qjson-bad-pdf-version2.json: errors found in JSON | 5 | qpdf: qjson-bad-pdf-version2.json: errors found in JSON |