aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_pages.cc
diff options
context:
space:
mode:
authorTobias Hoffmann <thobi@worker>2012-06-22 18:11:25 +0200
committerJay Berkenbilt <ejb@ql.org>2012-07-07 23:45:10 +0200
commit39bbaa86e3d7dcf77f42a36b78b727c142fcadee (patch)
tree13ee45290d8826f43d8701a712f0e05ebc4aec49 /libqpdf/QPDF_pages.cc
parente2dedde4bdb5fa68c86d412e534a4b2750739988 (diff)
downloadqpdf-39bbaa86e3d7dcf77f42a36b78b727c142fcadee.tar.zst
Build this->all_pages while traversing with pushInheritedAttributesToPage
Diffstat (limited to 'libqpdf/QPDF_pages.cc')
-rw-r--r--libqpdf/QPDF_pages.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/libqpdf/QPDF_pages.cc b/libqpdf/QPDF_pages.cc
index 11e21266..818215c4 100644
--- a/libqpdf/QPDF_pages.cc
+++ b/libqpdf/QPDF_pages.cc
@@ -43,6 +43,8 @@
std::vector<QPDFObjectHandle> const&
QPDF::getAllPages()
{
+ // Note that pushInheritedAttributesToPage may also be used to
+ // initialize this->all_pages.
if (this->all_pages.empty())
{
getAllPagesInternal(getRoot().getKey("/Pages"), this->all_pages);
@@ -101,9 +103,9 @@ QPDF::flattenPagesTree()
return;
}
- // Push inherited objects down to the /Page level
+ // Push inherited objects down to the /Page level. As a side
+ // effect this->all_pages will also be generated.
pushInheritedAttributesToPage(true, true);
- getAllPages();
QPDFObjectHandle pages = getRoot().getKey("/Pages");
@@ -228,14 +230,14 @@ QPDF::addPageAt(QPDFObjectHandle newpage, bool before,
void
QPDF::addPage(QPDFObjectHandle newpage, bool first)
{
- getAllPages();
if (first)
{
insertPage(newpage, 0);
}
else
{
- insertPage(newpage, (int)this->all_pages.size());
+ insertPage(newpage,
+ getRoot().getKey("/Pages").getKey("/Count").getIntValue());
}
}