From 5708b5d0aa9c94ab663509fbb865aa27a134aeb3 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sun, 11 Feb 2018 15:41:02 -0500 Subject: Add additional interface for filtering page contents --- libqpdf/QPDFObjectHandle.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'libqpdf') diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index bba95938..5d7b0bb9 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include #include @@ -998,6 +1000,24 @@ QPDFObjectHandle::parsePageContents(ParserCallbacks* callbacks) description, callbacks); } +void +QPDFObjectHandle::filterPageContents(TokenFilter* filter, Pipeline* next) +{ + assertPageObject(); + std::string description = "token filter for page object " + + QUtil::int_to_string(this->objid) + " " + + QUtil::int_to_string(this->generation); + Pl_QPDFTokenizer token_pipeline(description.c_str(), filter); + PointerHolder next_p; + if (next == 0) + { + next_p = new Pl_Discard(); + next = next_p.getPointer(); + } + filter->setPipeline(next); + this->pipePageContents(&token_pipeline); +} + void QPDFObjectHandle::parseContentStream(QPDFObjectHandle stream_or_array, ParserCallbacks* callbacks) -- cgit v1.2.3-54-g00ecf