aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-06-25 19:55:45 +0200
committerJay Berkenbilt <ejb@ql.org>2022-06-25 19:55:45 +0200
commit0c7c7e4ba485fd39f5b6d41fa2924c607d2eeda0 (patch)
tree2aff155bc6bac1e5a748262203a18c45096020c7 /libqpdf
parent25aff0bd52b0382b9349c81aaabc2fde51528923 (diff)
downloadqpdf-0c7c7e4ba485fd39f5b6d41fa2924c607d2eeda0.tar.zst
Track whether certain page modifying methods have been called
We need to know whether pushInheritedAttributesToPage or getAllPages have been called when generating JSON output. When reading the JSON back in, we have to call the same methods so that object numbers will line up properly.
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDF.cc14
-rw-r--r--libqpdf/QPDF_optimization.cc1
-rw-r--r--libqpdf/QPDF_pages.cc1
3 files changed, 16 insertions, 0 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index 2d92bf1d..b51c5571 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -222,6 +222,8 @@ QPDF::Members::Members() :
attempt_recovery(true),
encp(new EncryptionParameters),
pushed_inherited_attributes_to_pages(false),
+ ever_pushed_inherited_attributes_to_pages(false),
+ ever_called_get_all_pages(false),
copied_stream_data_provider(0),
reconstructed_xref(false),
fixed_dangling_refs(false),
@@ -2879,3 +2881,15 @@ QPDF::stopOnError(std::string const& message)
this->m->file->getLastOffset(),
message);
}
+
+bool
+QPDF::everCalledGetAllPages() const
+{
+ return this->m->ever_called_get_all_pages;
+}
+
+bool
+QPDF::everPushedInheritedAttributesToPages() const
+{
+ return this->m->ever_pushed_inherited_attributes_to_pages;
+}
diff --git a/libqpdf/QPDF_optimization.cc b/libqpdf/QPDF_optimization.cc
index da0db663..1fd6da6f 100644
--- a/libqpdf/QPDF_optimization.cc
+++ b/libqpdf/QPDF_optimization.cc
@@ -162,6 +162,7 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys)
" pushing inherited attributes to pages");
}
this->m->pushed_inherited_attributes_to_pages = true;
+ this->m->ever_pushed_inherited_attributes_to_pages = true;
}
void
diff --git a/libqpdf/QPDF_pages.cc b/libqpdf/QPDF_pages.cc
index bfd593a2..bd3f80a6 100644
--- a/libqpdf/QPDF_pages.cc
+++ b/libqpdf/QPDF_pages.cc
@@ -54,6 +54,7 @@ QPDF::getAllPages()
// Note that pushInheritedAttributesToPage may also be used to
// initialize this->m->all_pages.
if (this->m->all_pages.empty()) {
+ this->m->ever_called_get_all_pages = true;
std::set<QPDFObjGen> visited;
std::set<QPDFObjGen> seen;
QPDFObjectHandle pages = getRoot().getKey("/Pages");