Commit 6b576797cd2d54c8825e1ebf845ab2618ab4c3fd
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 | 1041 | void |
| 1042 | 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 | 1044 | bool all_objects = m->json_objects.empty(); |
| 1048 | 1045 | std::set<QPDFObjGen> wanted_og = getWantedJSONObjects(); |
| 1049 | 1046 | JSON j_objects = j.addDictionaryMember("objects", JSON::makeDictionary()); |
| ... | ... | @@ -1062,8 +1059,6 @@ QPDFJob::doJSONObjects(QPDF& pdf, JSON& j) |
| 1062 | 1059 | void |
| 1063 | 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 | 1062 | bool all_objects = m->json_objects.empty(); |
| 1068 | 1063 | std::set<QPDFObjGen> wanted_og = getWantedJSONObjects(); |
| 1069 | 1064 | JSON j_objectinfo = |
| ... | ... | @@ -1095,7 +1090,6 @@ QPDFJob::doJSONPages(QPDF& pdf, JSON& j) |
| 1095 | 1090 | QPDFPageDocumentHelper pdh(pdf); |
| 1096 | 1091 | QPDFPageLabelDocumentHelper pldh(pdf); |
| 1097 | 1092 | QPDFOutlineDocumentHelper odh(pdf); |
| 1098 | - pdh.pushInheritedAttributesToPage(); | |
| 1099 | 1093 | std::vector<QPDFPageObjectHelper> pages = pdh.getAllPages(); |
| 1100 | 1094 | int pageno = -1; |
| 1101 | 1095 | for (auto& ph: pages) { |
| ... | ... | @@ -1624,7 +1618,9 @@ QPDFJob::doJSON(QPDF& pdf) |
| 1624 | 1618 | bool all_keys = m->json_keys.empty(); |
| 1625 | 1619 | // The list of selectable top-level keys id duplicated in the |
| 1626 | 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 | 1624 | if (all_keys || m->json_keys.count("objects")) { |
| 1629 | 1625 | doJSONObjects(pdf, j); |
| 1630 | 1626 | } | ... | ... |