2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-12 15:12:22 +00:00
qpdf/qpdf/qtest/qpdf/page_api_2-json-pages.out
Jay Berkenbilt 948de60990 Objects json: write incrementally and in numeric order
The following script was used to adjust test data:

----------
#!/usr/bin/env python3
import json
import sys
import re

def json_dumps(data):
    return json.dumps(data, ensure_ascii=False,
                      indent=2, separators=(',', ': '))

for filename in sys.argv[1:]:
    with open(filename, 'r') as f:
        data = json.loads(f.read())
    if 'objects' not in data:
        continue
    trailer = None
    to_sort = []
    for k, v in data['objects'].items():
        if k == 'trailer':
            trailer = v
        else:
            m = re.match(r'^(\d+) \d+ R', k)
            if m:
                to_sort.append([int(m.group(1)), k, v])
    newobjects = {x[1]: x[2] for x in sorted(to_sort)}
    if trailer is not None:
        newobjects['trailer'] = trailer
    data['objects'] = newobjects
print(json_dumps(data))
----------
2022-05-07 08:26:31 -04:00

220 lines
3.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"version": 1,
"parameters": {
"decodelevel": "generalized"
},
"pages": [
{
"contents": [
"6 0 R"
],
"images": [],
"label": null,
"object": "4 0 R",
"outlines": [],
"pageposfrom1": 1
},
{
"contents": [
"6 0 R"
],
"images": [],
"label": null,
"object": "11 0 R",
"outlines": [],
"pageposfrom1": 2
},
{
"contents": [
"9 0 R"
],
"images": [],
"label": null,
"object": "5 0 R",
"outlines": [],
"pageposfrom1": 3
}
],
"objects": {
"1 0 R": {
"/Pages": "3 0 R",
"/Type": "/Catalog"
},
"2 0 R": {
"/CreationDate": "D:20120621124041",
"/Producer": "Apex PDFWriter"
},
"3 0 R": {
"/Count": 3,
"/Kids": [
"4 0 R",
"11 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"
},
"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"
},
"trailer": {
"/ID": [
"û˘·ƒÿ{5\u0005ÚS*ºo",
"÷\u0017ž³QY¿ÔÀ\u000f\u0012¼ý˜\u0002"
],
"/Info": "2 0 R",
"/Root": "1 0 R",
"/Size": 11
}
},
"objectinfo": {
"1 0 R": {
"stream": {
"filter": null,
"is": false,
"length": null
}
},
"10 0 R": {
"stream": {
"filter": null,
"is": false,
"length": null
}
},
"11 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
}
}
}
}