diff options
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 9 | ||||
-rw-r--r-- | libqpdf/QPDFPageObjectHelper.cc | 40 |
2 files changed, 46 insertions, 3 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 94b81f3d..60419720 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -1669,6 +1669,15 @@ QPDFObjectHandle::parsePageContents(ParserCallbacks* callbacks) } void +QPDFObjectHandle::parseAsContents(ParserCallbacks* callbacks) +{ + std::string description = "object " + + QUtil::int_to_string(this->objid) + " " + + QUtil::int_to_string(this->generation); + this->parseContentStream_internal(description, callbacks); +} + +void QPDFObjectHandle::filterPageContents(TokenFilter* filter, Pipeline* next) { std::string description = "token filter for page object " + diff --git a/libqpdf/QPDFPageObjectHelper.cc b/libqpdf/QPDFPageObjectHelper.cc index f7fcd395..3e303f6a 100644 --- a/libqpdf/QPDFPageObjectHelper.cc +++ b/libqpdf/QPDFPageObjectHelper.cc @@ -584,7 +584,21 @@ void QPDFPageObjectHelper::parsePageContents( QPDFObjectHandle::ParserCallbacks* callbacks) { - this->oh.parsePageContents(callbacks); + parseContents(callbacks); +} + +void +QPDFPageObjectHelper::parseContents( + QPDFObjectHandle::ParserCallbacks* callbacks) +{ + if (this->oh.isFormXObject()) + { + this->oh.parseAsContents(callbacks); + } + else + { + this->oh.parsePageContents(callbacks); + } } void @@ -613,14 +627,34 @@ QPDFPageObjectHelper::filterContents( void QPDFPageObjectHelper::pipePageContents(Pipeline* p) { - this->oh.pipePageContents(p); + pipeContents(p); +} + +void +QPDFPageObjectHelper::pipeContents(Pipeline* p) +{ + if (this->oh.isFormXObject()) + { + this->oh.pipeStreamData(p, 0, qpdf_dl_specialized); + } + else + { + this->oh.pipePageContents(p); + } } void QPDFPageObjectHelper::addContentTokenFilter( PointerHolder<QPDFObjectHandle::TokenFilter> token_filter) { - this->oh.addContentTokenFilter(token_filter); + if (this->oh.isFormXObject()) + { + this->oh.addTokenFilter(token_filter); + } + else + { + this->oh.addContentTokenFilter(token_filter); + } } class NameWatcher: public QPDFObjectHandle::TokenFilter |