diff options
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() { |