aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pdf-count-strings.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2018-06-18 21:06:51 +0200
committerJay Berkenbilt <ejb@ql.org>2018-06-21 21:57:13 +0200
commit2e6e1204a51b4aba4657712a34e9447d928b5fc6 (patch)
tree20d3a41ae488640b6f7b6345b98c33845e6e014c /examples/pdf-count-strings.cc
parent2e7ee23bf63da6de221737907bcc6fa8526c3fda (diff)
downloadqpdf-2e6e1204a51b4aba4657712a34e9447d928b5fc6.tar.zst
Convert examples to use new page helper classes
Diffstat (limited to 'examples/pdf-count-strings.cc')
-rw-r--r--examples/pdf-count-strings.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/pdf-count-strings.cc b/examples/pdf-count-strings.cc
index 072f8b5c..b5091a86 100644
--- a/examples/pdf-count-strings.cc
+++ b/examples/pdf-count-strings.cc
@@ -10,6 +10,8 @@
#include <stdlib.h>
#include <qpdf/QPDF.hh>
+#include <qpdf/QPDFPageDocumentHelper.hh>
+#include <qpdf/QPDFPageObjectHelper.hh>
#include <qpdf/QUtil.hh>
#include <qpdf/QPDFObjectHandle.hh>
#include <qpdf/Pl_StdioFile.hh>
@@ -90,12 +92,13 @@ int main(int argc, char* argv[])
{
QPDF pdf;
pdf.processFile(infilename);
- std::vector<QPDFObjectHandle> pages = pdf.getAllPages();
+ std::vector<QPDFPageObjectHelper> pages =
+ QPDFPageDocumentHelper(pdf).getAllPages();
int pageno = 0;
- for (std::vector<QPDFObjectHandle>::iterator iter = pages.begin();
+ for (std::vector<QPDFPageObjectHelper>::iterator iter = pages.begin();
iter != pages.end(); ++iter)
{
- QPDFObjectHandle page = *iter;
+ QPDFPageObjectHelper& ph(*iter);
++pageno;
// Pass the contents of a page through our string counter.
// If it's an even page, capture the output. This
@@ -105,14 +108,14 @@ int main(int argc, char* argv[])
if (pageno % 2)
{
// Ignore output for odd pages.
- page.filterPageContents(&counter);
+ ph.filterPageContents(&counter);
}
else
{
// Write output to stdout for even pages.
Pl_StdioFile out("stdout", stdout);
std::cout << "% Contents of page " << pageno << std::endl;
- page.filterPageContents(&counter, &out);
+ ph.filterPageContents(&counter, &out);
std::cout << "\n% end " << pageno << std::endl;
}
std::cout << "Page " << pageno