diff options
author | Jay Berkenbilt <ejb@ql.org> | 2018-06-19 15:26:41 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2018-06-21 21:57:13 +0200 |
commit | 0b05111db80469d3f556209bfd856af1fda9b142 (patch) | |
tree | 46aca07e5984bfda3b284bb70383b11840cb3436 /libqpdf/QPDFPageObjectHelper.cc | |
parent | 0dadf17ab705fa2f96f0513278672978d73601ed (diff) | |
download | qpdf-0b05111db80469d3f556209bfd856af1fda9b142.tar.zst |
Implement helper class for interactive forms
Diffstat (limited to 'libqpdf/QPDFPageObjectHelper.cc')
-rw-r--r-- | libqpdf/QPDFPageObjectHelper.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libqpdf/QPDFPageObjectHelper.cc b/libqpdf/QPDFPageObjectHelper.cc index b16d8751..47bc2117 100644 --- a/libqpdf/QPDFPageObjectHelper.cc +++ b/libqpdf/QPDFPageObjectHelper.cc @@ -19,6 +19,29 @@ QPDFPageObjectHelper::getPageImages() return this->oh.getPageImages(); } +std::vector<QPDFAnnotationObjectHelper> +QPDFPageObjectHelper::getAnnotations(std::string const& only_subtype) +{ + std::vector<QPDFAnnotationObjectHelper> result; + QPDFObjectHandle annots = this->oh.getKey("/Annots"); + if (annots.isArray()) + { + size_t nannots = annots.getArrayNItems(); + for (size_t i = 0; i < nannots; ++i) + { + QPDFObjectHandle annot = annots.getArrayItem(i); + if (only_subtype.empty() || + (annot.isDictionary() && + annot.getKey("/Subtype").isName() && + (only_subtype == annot.getKey("/Subtype").getName()))) + { + result.push_back(QPDFAnnotationObjectHelper(annot)); + } + } + } + return result; +} + std::vector<QPDFObjectHandle> QPDFPageObjectHelper::getPageContents() { |