From 52f9d326a56e6409a1487c724241f91de33e3ba6 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 28 Jan 2019 20:13:10 -0500 Subject: 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. --- libqpdf/QPDF_optimization.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libqpdf/QPDF_optimization.cc') 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 > key_ancestors; -- cgit v1.2.3-70-g09d2