diff options
author | Jay Berkenbilt <ejb@ql.org> | 2018-02-11 21:41:02 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2018-02-19 03:05:47 +0100 |
commit | 5708b5d0aa9c94ab663509fbb865aa27a134aeb3 (patch) | |
tree | 30a85d51d3d720dfca0a09b9dba4eef0c3fe2bec /libqpdf/QPDFObjectHandle.cc | |
parent | fd02944e1953931e07f124448350db91038020af (diff) | |
download | qpdf-5708b5d0aa9c94ab663509fbb865aa27a134aeb3.tar.zst |
Add additional interface for filtering page contents
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 20 |
1 files changed, 20 insertions, 0 deletions
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 <qpdf/QPDF_Reserved.hh> #include <qpdf/Pl_Buffer.hh> #include <qpdf/Pl_Concatenate.hh> +#include <qpdf/Pl_QPDFTokenizer.hh> +#include <qpdf/Pl_Discard.hh> #include <qpdf/BufferInputSource.hh> #include <qpdf/QPDFExc.hh> @@ -999,6 +1001,24 @@ QPDFObjectHandle::parsePageContents(ParserCallbacks* 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<Pipeline> 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) { |