From 6b576797cd2d54c8825e1ebf845ab2618ab4c3fd Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Wed, 4 May 2022 07:11:13 -0400 Subject: Don't call pushInheritedAttributesToPage in json mode We used to have to do that, but for quite some time, the code that gets images has no longer required it. --- libqpdf/QPDFJob.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index bcaa2ebe..0c9b1583 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -1041,9 +1041,6 @@ QPDFJob::getWantedJSONObjects() void QPDFJob::doJSONObjects(QPDF& pdf, JSON& j) { - // Add all objects. Do this first before other code below modifies - // things by doing stuff like calling - // pushInheritedAttributesToPage. bool all_objects = m->json_objects.empty(); std::set wanted_og = getWantedJSONObjects(); JSON j_objects = j.addDictionaryMember("objects", JSON::makeDictionary()); @@ -1062,8 +1059,6 @@ QPDFJob::doJSONObjects(QPDF& pdf, JSON& j) void QPDFJob::doJSONObjectinfo(QPDF& pdf, JSON& j) { - // Do this first before other code below modifies things by doing - // stuff like calling pushInheritedAttributesToPage. bool all_objects = m->json_objects.empty(); std::set wanted_og = getWantedJSONObjects(); JSON j_objectinfo = @@ -1095,7 +1090,6 @@ QPDFJob::doJSONPages(QPDF& pdf, JSON& j) QPDFPageDocumentHelper pdh(pdf); QPDFPageLabelDocumentHelper pldh(pdf); QPDFOutlineDocumentHelper odh(pdf); - pdh.pushInheritedAttributesToPage(); std::vector pages = pdh.getAllPages(); int pageno = -1; for (auto& ph: pages) { @@ -1624,7 +1618,9 @@ 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. + // 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); } -- cgit v1.2.3-54-g00ecf