aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-05-04 13:32:30 +0200
committerJay Berkenbilt <ejb@ql.org>2022-05-04 14:32:44 +0200
commit8b25de24c9b1e6acba042ea9ecdee783839e20a6 (patch)
tree5e6b24aab3297cc13aeb4802ab2bc77ad9306288 /libqpdf
parent6b576797cd2d54c8825e1ebf845ab2618ab4c3fd (diff)
downloadqpdf-8b25de24c9b1e6acba042ea9ecdee783839e20a6.tar.zst
Make "objects" and "pages" consistent in JSON output
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFJob.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc
index 0c9b1583..ca56b8d5 100644
--- a/libqpdf/QPDFJob.cc
+++ b/libqpdf/QPDFJob.cc
@@ -1618,15 +1618,7 @@ QPDFJob::doJSON(QPDF& pdf)
bool all_keys = m->json_keys.empty();
// The list of selectable top-level keys id duplicated in the
// following places: job.yml, QPDFJob::json_schema, and
- // QPDFJob::doJSON. We do objects and objectinfo first so they
- // reflect the original file without any side effects caused by
- // other operations, such as repairing the pages tree.
- if (all_keys || m->json_keys.count("objects")) {
- doJSONObjects(pdf, j);
- }
- if (all_keys || m->json_keys.count("objectinfo")) {
- doJSONObjectinfo(pdf, j);
- }
+ // QPDFJob::doJSON.
if (all_keys || m->json_keys.count("pages")) {
doJSONPages(pdf, j);
}
@@ -1646,6 +1638,17 @@ QPDFJob::doJSON(QPDF& pdf)
doJSONAttachments(pdf, j);
}
+ // We do objects and objectinfo last so their information is
+ // consistent with repairing the page tree. To see the original
+ // file with any page tree problems and the page tree not
+ // flattened, select objects/objectinfo without other keys.
+ if (all_keys || m->json_keys.count("objects")) {
+ doJSONObjects(pdf, j);
+ }
+ if (all_keys || m->json_keys.count("objectinfo")) {
+ doJSONObjectinfo(pdf, j);
+ }
+
// Check against schema
JSON schema = json_schema(&m->json_keys);