aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-01-02 20:05:17 +0100
committerJay Berkenbilt <ejb@ql.org>2021-01-02 20:08:53 +0100
commit3be58f49e57da67cf79b61061d8b1a0f7ccf7cff (patch)
tree2d651afb06b9037d5dc8aab2745ea9e65652885f /libqpdf
parent98da4fd83527f47a28132ff4a120bc043d9e58f6 (diff)
downloadqpdf-3be58f49e57da67cf79b61061d8b1a0f7ccf7cff.tar.zst
Make more QPDFPageObjectHelper methods work with form XObject
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFObjectHandle.cc9
-rw-r--r--libqpdf/QPDFPageObjectHelper.cc40
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