summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTobias Hoffmann <thobi@worker>2012-06-19 01:53:10 +0200
committerJay Berkenbilt <ejb@ql.org>2012-06-21 21:01:02 +0200
commit5d3f93be29800dd0eb876c3062451d32e7798948 (patch)
tree76b6d3767d20edb4e516254131549d28c6d658c5 /include
parent405a549f8c86769d14d6a350621f4642dd30920f (diff)
downloadqpdf-5d3f93be29800dd0eb876c3062451d32e7798948.tar.zst
Added first version of pages API.
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDF.hh25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh
index 048bad47..8d8f4a3e 100644
--- a/include/qpdf/QPDF.hh
+++ b/include/qpdf/QPDF.hh
@@ -344,9 +344,24 @@ class QPDF
QPDF_DLL
std::vector<QPDFObjectHandle> const& getAllPages();
+ // QPDF internally caches the /Pages tree. This method will clear
+ // the cache when e.g. direct modifications have been made.
QPDF_DLL
void clearPagesCache();
+ // Add new page at the beginning or the end of the current pdf
+ QPDF_DLL
+ void addPage(QPDFObjectHandle newpage, bool first);
+
+ // Add new page before or after refpage
+ QPDF_DLL
+ void addPageAt(QPDFObjectHandle newpage, bool before,
+ QPDFObjectHandle const& refpage);
+
+ // Remove pageoh from the pdf.
+ QPDF_DLL
+ void removePage(QPDFObjectHandle const& pageoh);
+
// Resolver class is restricted to QPDFObjectHandle so that only
// it can resolve indirect references.
class Resolver
@@ -521,8 +536,17 @@ class QPDF
off_t offset, size_t length,
QPDFObjectHandle dict,
Pipeline* pipeline);
+
+ // methods to support page handling
+
void getAllPagesInternal(QPDFObjectHandle cur_pages,
std::vector<QPDFObjectHandle>& result);
+ // creates pageobj_to_pages_pos if necessary
+ // returns position, or -1 if not found
+ int findPage(int objid, int generation);
+ int findPage(QPDFObjectHandle const& pageoh); // convenience
+
+ void flattenPagesTree();
// methods to support encryption -- implemented in QPDF_encryption.cc
encryption_method_e interpretCF(QPDFObjectHandle);
@@ -887,6 +911,7 @@ class QPDF
std::map<ObjGen, ObjCache> obj_cache;
QPDFObjectHandle trailer;
std::vector<QPDFObjectHandle> all_pages;
+ std::map<ObjGen, int> pageobj_to_pages_pos;
std::vector<QPDFExc> warnings;
// Linearization data