diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-01-29 02:13:10 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-01-29 02:29:58 +0100 |
commit | 52f9d326a56e6409a1487c724241f91de33e3ba6 (patch) | |
tree | a45d1cc452d3d61a940b16cc6a6bb524b55f302b /libqpdf/QPDF_optimization.cc | |
parent | 9e01c8bd996a15934f58979f447bea359e857875 (diff) | |
download | qpdf-52f9d326a56e6409a1487c724241f91de33e3ba6.tar.zst |
Resolve duplicated page objects (fixes #268)
When linearizing a file or getting the list of all pages in a file,
detect if the pages tree contains a duplicated page object and, if so,
shallow copy it. This makes it possible to have a one to one mapping
of page positions to page objects.
Diffstat (limited to 'libqpdf/QPDF_optimization.cc')
-rw-r--r-- | libqpdf/QPDF_optimization.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libqpdf/QPDF_optimization.cc b/libqpdf/QPDF_optimization.cc index f282e5f3..ecece7db 100644 --- a/libqpdf/QPDF_optimization.cc +++ b/libqpdf/QPDF_optimization.cc @@ -156,6 +156,9 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys) return; } + // Calling getAllPages() resolves any duplicated page objects. + getAllPages(); + // key_ancestors is a mapping of page attribute keys to a stack of // Pages nodes that contain values for them. std::map<std::string, std::vector<QPDFObjectHandle> > key_ancestors; |