Commit 6b576797cd2d54c8825e1ebf845ab2618ab4c3fd

Authored by Jay Berkenbilt
1 parent f4206a09

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.
Showing 1 changed file with 3 additions and 7 deletions
libqpdf/QPDFJob.cc
@@ -1041,9 +1041,6 @@ QPDFJob::getWantedJSONObjects() @@ -1041,9 +1041,6 @@ QPDFJob::getWantedJSONObjects()
1041 void 1041 void
1042 QPDFJob::doJSONObjects(QPDF& pdf, JSON& j) 1042 QPDFJob::doJSONObjects(QPDF& pdf, JSON& j)
1043 { 1043 {
1044 - // Add all objects. Do this first before other code below modifies  
1045 - // things by doing stuff like calling  
1046 - // pushInheritedAttributesToPage.  
1047 bool all_objects = m->json_objects.empty(); 1044 bool all_objects = m->json_objects.empty();
1048 std::set<QPDFObjGen> wanted_og = getWantedJSONObjects(); 1045 std::set<QPDFObjGen> wanted_og = getWantedJSONObjects();
1049 JSON j_objects = j.addDictionaryMember("objects", JSON::makeDictionary()); 1046 JSON j_objects = j.addDictionaryMember("objects", JSON::makeDictionary());
@@ -1062,8 +1059,6 @@ QPDFJob::doJSONObjects(QPDF&amp; pdf, JSON&amp; j) @@ -1062,8 +1059,6 @@ QPDFJob::doJSONObjects(QPDF&amp; pdf, JSON&amp; j)
1062 void 1059 void
1063 QPDFJob::doJSONObjectinfo(QPDF& pdf, JSON& j) 1060 QPDFJob::doJSONObjectinfo(QPDF& pdf, JSON& j)
1064 { 1061 {
1065 - // Do this first before other code below modifies things by doing  
1066 - // stuff like calling pushInheritedAttributesToPage.  
1067 bool all_objects = m->json_objects.empty(); 1062 bool all_objects = m->json_objects.empty();
1068 std::set<QPDFObjGen> wanted_og = getWantedJSONObjects(); 1063 std::set<QPDFObjGen> wanted_og = getWantedJSONObjects();
1069 JSON j_objectinfo = 1064 JSON j_objectinfo =
@@ -1095,7 +1090,6 @@ QPDFJob::doJSONPages(QPDF&amp; pdf, JSON&amp; j) @@ -1095,7 +1090,6 @@ QPDFJob::doJSONPages(QPDF&amp; pdf, JSON&amp; j)
1095 QPDFPageDocumentHelper pdh(pdf); 1090 QPDFPageDocumentHelper pdh(pdf);
1096 QPDFPageLabelDocumentHelper pldh(pdf); 1091 QPDFPageLabelDocumentHelper pldh(pdf);
1097 QPDFOutlineDocumentHelper odh(pdf); 1092 QPDFOutlineDocumentHelper odh(pdf);
1098 - pdh.pushInheritedAttributesToPage();  
1099 std::vector<QPDFPageObjectHelper> pages = pdh.getAllPages(); 1093 std::vector<QPDFPageObjectHelper> pages = pdh.getAllPages();
1100 int pageno = -1; 1094 int pageno = -1;
1101 for (auto& ph: pages) { 1095 for (auto& ph: pages) {
@@ -1624,7 +1618,9 @@ QPDFJob::doJSON(QPDF&amp; pdf) @@ -1624,7 +1618,9 @@ QPDFJob::doJSON(QPDF&amp; pdf)
1624 bool all_keys = m->json_keys.empty(); 1618 bool all_keys = m->json_keys.empty();
1625 // The list of selectable top-level keys id duplicated in the 1619 // The list of selectable top-level keys id duplicated in the
1626 // following places: job.yml, QPDFJob::json_schema, and 1620 // following places: job.yml, QPDFJob::json_schema, and
1627 - // QPDFJob::doJSON. 1621 + // QPDFJob::doJSON. We do objects and objectinfo first so they
  1622 + // reflect the original file without any side effects caused by
  1623 + // other operations, such as repairing the pages tree.
1628 if (all_keys || m->json_keys.count("objects")) { 1624 if (all_keys || m->json_keys.count("objects")) {
1629 doJSONObjects(pdf, j); 1625 doJSONObjects(pdf, j);
1630 } 1626 }