From e3144ac4177b7c38567f41a8e31a6c162d3b76f4 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 1 Jan 2019 21:27:18 -0500 Subject: Add form fields to json output Also add some additional methods for detecting form field types to assist in the json creation and for later use. --- libqpdf/QPDFAnnotationObjectHelper.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'libqpdf/QPDFAnnotationObjectHelper.cc') diff --git a/libqpdf/QPDFAnnotationObjectHelper.cc b/libqpdf/QPDFAnnotationObjectHelper.cc index 3295fd3a..5e4be795 100644 --- a/libqpdf/QPDFAnnotationObjectHelper.cc +++ b/libqpdf/QPDFAnnotationObjectHelper.cc @@ -49,6 +49,13 @@ QPDFAnnotationObjectHelper::getAppearanceState() return ""; } +int +QPDFAnnotationObjectHelper::getFlags() +{ + QPDFObjectHandle flags_obj = this->oh.getKey("/F"); + return flags_obj.isInteger() ? flags_obj.getIntValue() : 0; +} + QPDFObjectHandle QPDFAnnotationObjectHelper::getAppearanceStream( std::string const& which, @@ -169,13 +176,11 @@ QPDFAnnotationObjectHelper::getPageContentForAppearance( // appearance matrix. QPDFObjectHandle rect_obj = this->oh.getKey("/Rect"); - QPDFObjectHandle flags_obj = this->oh.getKey("/F"); QPDFObjectHandle as = getAppearanceStream("/N").getDict(); QPDFObjectHandle bbox_obj = as.getKey("/BBox"); QPDFObjectHandle matrix_obj = as.getKey("/Matrix"); - int flags = flags_obj.isInteger() ? flags_obj.getIntValue() : 0; - + int flags = getFlags(); if (flags & forbidden_flags) { QTC::TC("qpdf", "QPDFAnnotationObjectHelper forbidden flags"); -- cgit v1.2.3-54-g00ecf