diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-05-04 13:32:30 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-05-04 14:32:44 +0200 |
commit | 8b25de24c9b1e6acba042ea9ecdee783839e20a6 (patch) | |
tree | 5e6b24aab3297cc13aeb4802ab2bc77ad9306288 /qpdf | |
parent | 6b576797cd2d54c8825e1ebf845ab2618ab4c3fd (diff) | |
download | qpdf-8b25de24c9b1e6acba042ea9ecdee783839e20a6.tar.zst |
Make "objects" and "pages" consistent in JSON output
Diffstat (limited to 'qpdf')
-rw-r--r-- | qpdf/qtest/qpdf.test | 22 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/direct-pages-json-objects.out (renamed from qpdf/qtest/qpdf/direct-pages-json.out) | 57 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/direct-pages-json-pages.out | 157 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/page_api_2-json-objects.out | 160 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/page_api_2-json-pages.out (renamed from qpdf/qtest/qpdf/page_api_2-json.out) | 64 |
5 files changed, 360 insertions, 100 deletions
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test index d8359f75..3b26c9c8 100644 --- a/qpdf/qtest/qpdf.test +++ b/qpdf/qtest/qpdf.test @@ -2829,7 +2829,7 @@ $td->runtest("check output", show_ntests(); # ---------- $td->notify("--- Page Tree Issues ---"); -$n_tests += 9; +$n_tests += 11; $td->runtest("linearize duplicated pages", {$td->COMMAND => @@ -2864,14 +2864,22 @@ $td->runtest("show direct pages", $td->NORMALIZE_NEWLINES); # Json mode for direct and duplicated pages illustrates that the -# "objects" section still shows the original objects before correction -# but the "pages" section shows the pages with their new object -# numbers. +# "objects" section the original objects before correction when +# "pages" is not output but after correct when it is.# numbers. foreach my $f (qw(page_api_2 direct-pages)) { - $td->runtest("json for $f", - {$td->COMMAND => "qpdf --json=latest $f.pdf"}, - {$td->FILE => "$f-json.out", $td->EXIT_STATUS => 0}, + $td->runtest("json for $f (objects only)", + {$td->COMMAND => + "qpdf --json=latest $f.pdf" . + " --json-key=objects --json-key=objectinfo"}, + {$td->FILE => "$f-json-objects.out", $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); + $td->runtest("json for $f (with pages)", + {$td->COMMAND => + "qpdf --json=latest $f.pdf" . + " --json-key=objects --json-key=objectinfo" . + " --json-key=pages"}, + {$td->FILE => "$f-json-pages.out", $td->EXIT_STATUS => 0}, $td->NORMALIZE_NEWLINES); } diff --git a/qpdf/qtest/qpdf/direct-pages-json.out b/qpdf/qtest/qpdf/direct-pages-json-objects.out index 52e5e2dd..1c1c50a3 100644 --- a/qpdf/qtest/qpdf/direct-pages-json.out +++ b/qpdf/qtest/qpdf/direct-pages-json-objects.out @@ -1,37 +1,4 @@ { - "acroform": { - "fields": [], - "hasacroform": false, - "needappearances": false - }, - "attachments": {}, - "encrypt": { - "capabilities": { - "accessibility": true, - "extract": true, - "moddifyannotations": true, - "modify": true, - "modifyassembly": true, - "modifyforms": true, - "modifyother": true, - "printhigh": true, - "printlow": true - }, - "encrypted": false, - "ownerpasswordmatched": false, - "parameters": { - "P": 0, - "R": 0, - "V": 0, - "bits": 0, - "filemethod": "none", - "key": null, - "method": "none", - "streammethod": "none", - "stringmethod": "none" - }, - "userpasswordmatched": false - }, "objectinfo": { "1 0 R": { "stream": { @@ -145,30 +112,6 @@ "/Size": 7 } }, - "outlines": [], - "pagelabels": [], - "pages": [ - { - "contents": [ - "3 0 R" - ], - "images": [], - "label": null, - "object": "7 0 R", - "outlines": [], - "pageposfrom1": 1 - }, - { - "contents": [ - "3 0 R" - ], - "images": [], - "label": null, - "object": "8 0 R", - "outlines": [], - "pageposfrom1": 2 - } - ], "parameters": { "decodelevel": "generalized" }, diff --git a/qpdf/qtest/qpdf/direct-pages-json-pages.out b/qpdf/qtest/qpdf/direct-pages-json-pages.out new file mode 100644 index 00000000..ee2c03d4 --- /dev/null +++ b/qpdf/qtest/qpdf/direct-pages-json-pages.out @@ -0,0 +1,157 @@ +{ + "objectinfo": { + "1 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "2 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "3 0 R": { + "stream": { + "filter": null, + "is": true, + "length": 44 + } + }, + "4 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "5 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "6 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "7 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "8 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + } + }, + "objects": { + "1 0 R": { + "/Pages": "2 0 R", + "/Type": "/Catalog" + }, + "2 0 R": { + "/Count": 2, + "/Kids": [ + "7 0 R", + "8 0 R" + ], + "/Type": "/Pages" + }, + "3 0 R": { + "/Length": "4 0 R" + }, + "4 0 R": 44, + "5 0 R": { + "/BaseFont": "/Helvetica", + "/Encoding": "/WinAnsiEncoding", + "/Name": "/F1", + "/Subtype": "/Type1", + "/Type": "/Font" + }, + "6 0 R": [ + "/PDF", + "/Text" + ], + "7 0 R": { + "/Contents": "3 0 R", + "/MediaBox": [ + 0, + 0, + 612, + 792 + ], + "/Parent": "2 0 R", + "/Resources": { + "/Font": { + "/F1": "5 0 R" + }, + "/ProcSet": "6 0 R" + }, + "/Type": "/Page" + }, + "8 0 R": { + "/Contents": "3 0 R", + "/MediaBox": [ + 0, + 0, + 612, + 792 + ], + "/Parent": "2 0 R", + "/Resources": { + "/Font": { + "/F1": "5 0 R" + }, + "/ProcSet": "6 0 R" + }, + "/Type": "/Page" + }, + "trailer": { + "/ID": [ + "\u0013#¥fi|WzfsU…©6ŸÎ<", + "7,¿DöÛ‹«`Ù&<\u000f\u000bÒj" + ], + "/Root": "1 0 R", + "/Size": 7 + } + }, + "pages": [ + { + "contents": [ + "3 0 R" + ], + "images": [], + "label": null, + "object": "7 0 R", + "outlines": [], + "pageposfrom1": 1 + }, + { + "contents": [ + "3 0 R" + ], + "images": [], + "label": null, + "object": "8 0 R", + "outlines": [], + "pageposfrom1": 2 + } + ], + "parameters": { + "decodelevel": "generalized" + }, + "version": 1 +} diff --git a/qpdf/qtest/qpdf/page_api_2-json-objects.out b/qpdf/qtest/qpdf/page_api_2-json-objects.out new file mode 100644 index 00000000..76feb0d6 --- /dev/null +++ b/qpdf/qtest/qpdf/page_api_2-json-objects.out @@ -0,0 +1,160 @@ +{ + "objectinfo": { + "1 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "10 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "2 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "3 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "4 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "5 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "6 0 R": { + "stream": { + "filter": null, + "is": true, + "length": 47 + } + }, + "7 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "8 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, + "9 0 R": { + "stream": { + "filter": null, + "is": true, + "length": 47 + } + } + }, + "objects": { + "1 0 R": { + "/Pages": "3 0 R", + "/Type": "/Catalog" + }, + "10 0 R": 47, + "2 0 R": { + "/CreationDate": "D:20120621124041", + "/Producer": "Apex PDFWriter" + }, + "3 0 R": { + "/Count": 3, + "/Kids": [ + "4 0 R", + "4 0 R", + "5 0 R" + ], + "/Type": "/Pages" + }, + "4 0 R": { + "/Contents": "6 0 R", + "/MediaBox": [ + 0, + 0, + 612, + 792 + ], + "/Parent": "3 0 R", + "/Resources": { + "/Font": { + "/F1": "8 0 R" + }, + "/ProcSet": [ + "/PDF", + "/Text" + ] + }, + "/Type": "/Page" + }, + "5 0 R": { + "/Contents": "9 0 R", + "/MediaBox": [ + 0, + 0, + 612, + 792 + ], + "/Parent": "3 0 R", + "/Resources": { + "/Font": { + "/F1": "8 0 R" + }, + "/ProcSet": [ + "/PDF", + "/Text" + ] + }, + "/Type": "/Page" + }, + "6 0 R": { + "/Length": "7 0 R" + }, + "7 0 R": 47, + "8 0 R": { + "/BaseFont": "/Times-Roman", + "/Encoding": "/WinAnsiEncoding", + "/Subtype": "/Type1", + "/Type": "/Font" + }, + "9 0 R": { + "/Length": "10 0 R" + }, + "trailer": { + "/ID": [ + "û˘·ƒÿ{5⁄\u0005Ú−S*º‘o", + "÷\u0017ž³QY¿ÔÀ\u000f\u0012−¼ý˜\u0002" + ], + "/Info": "2 0 R", + "/Root": "1 0 R", + "/Size": 11 + } + }, + "parameters": { + "decodelevel": "generalized" + }, + "version": 1 +} diff --git a/qpdf/qtest/qpdf/page_api_2-json.out b/qpdf/qtest/qpdf/page_api_2-json-pages.out index bef00d02..d08e18d6 100644 --- a/qpdf/qtest/qpdf/page_api_2-json.out +++ b/qpdf/qtest/qpdf/page_api_2-json-pages.out @@ -1,37 +1,4 @@ { - "acroform": { - "fields": [], - "hasacroform": false, - "needappearances": false - }, - "attachments": {}, - "encrypt": { - "capabilities": { - "accessibility": true, - "extract": true, - "moddifyannotations": true, - "modify": true, - "modifyassembly": true, - "modifyforms": true, - "modifyother": true, - "printhigh": true, - "printlow": true - }, - "encrypted": false, - "ownerpasswordmatched": false, - "parameters": { - "P": 0, - "R": 0, - "V": 0, - "bits": 0, - "filemethod": "none", - "key": null, - "method": "none", - "streammethod": "none", - "stringmethod": "none" - }, - "userpasswordmatched": false - }, "objectinfo": { "1 0 R": { "stream": { @@ -47,6 +14,13 @@ "length": null } }, + "11 0 R": { + "stream": { + "filter": null, + "is": false, + "length": null + } + }, "2 0 R": { "stream": { "filter": null, @@ -110,6 +84,26 @@ "/Type": "/Catalog" }, "10 0 R": 47, + "11 0 R": { + "/Contents": "6 0 R", + "/MediaBox": [ + 0, + 0, + 612, + 792 + ], + "/Parent": "3 0 R", + "/Resources": { + "/Font": { + "/F1": "8 0 R" + }, + "/ProcSet": [ + "/PDF", + "/Text" + ] + }, + "/Type": "/Page" + }, "2 0 R": { "/CreationDate": "D:20120621124041", "/Producer": "Apex PDFWriter" @@ -118,7 +112,7 @@ "/Count": 3, "/Kids": [ "4 0 R", - "4 0 R", + "11 0 R", "5 0 R" ], "/Type": "/Pages" @@ -186,8 +180,6 @@ "/Size": 11 } }, - "outlines": [], - "pagelabels": [], "pages": [ { "contents": [ |