aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-02-22 23:44:13 +0100
committerJay Berkenbilt <ejb@ql.org>2021-02-23 00:42:06 +0100
commit1f35ec9988eaf1ad3705655c434701d175c5b49f (patch)
tree0b60da6e5f35a5ee00d98f272f9ec1d59ef85694 /include
parentf02aa74bf5387c30e4ff6082beeb4b0d078b6294 (diff)
downloadqpdf-1f35ec9988eaf1ad3705655c434701d175c5b49f.tar.zst
Add methods for copying form fields
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDFAcroFormDocumentHelper.hh12
-rw-r--r--include/qpdf/QPDFFormFieldObjectHelper.hh7
2 files changed, 19 insertions, 0 deletions
diff --git a/include/qpdf/QPDFAcroFormDocumentHelper.hh b/include/qpdf/QPDFAcroFormDocumentHelper.hh
index eb9da5ad..fd28a579 100644
--- a/include/qpdf/QPDFAcroFormDocumentHelper.hh
+++ b/include/qpdf/QPDFAcroFormDocumentHelper.hh
@@ -140,6 +140,11 @@ class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper
std::vector<QPDFAnnotationObjectHelper>
getWidgetAnnotationsForPage(QPDFPageObjectHelper);
+ // Return form fields for a page.
+ QPDF_DLL
+ std::vector<QPDFFormFieldObjectHelper>
+ getFormFieldsForPage(QPDFPageObjectHelper);
+
// Return the terminal field that is associated with this
// annotation. If the annotation dictionary is merged with the
// field dictionary, the underlying object will be the same, but
@@ -204,6 +209,13 @@ class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper
QPDF* from_qpdf = nullptr,
QPDFAcroFormDocumentHelper* from_afdh = nullptr);
+ // Copy form fields from a page in a different QPDF object to this
+ // QPDF.
+ QPDF_DLL
+ void copyFieldsFromForeignPage(
+ QPDFPageObjectHelper foreign_page,
+ QPDFAcroFormDocumentHelper& foreign_afdh);
+
private:
void analyze();
void traverseField(QPDFObjectHandle field,
diff --git a/include/qpdf/QPDFFormFieldObjectHelper.hh b/include/qpdf/QPDFFormFieldObjectHelper.hh
index b9168d22..edb93df8 100644
--- a/include/qpdf/QPDFFormFieldObjectHelper.hh
+++ b/include/qpdf/QPDFFormFieldObjectHelper.hh
@@ -54,6 +54,13 @@ class QPDFFormFieldObjectHelper: public QPDFObjectHelper
QPDF_DLL
QPDFFormFieldObjectHelper getParent();
+ // Return the top-level field for this field. Typically this will
+ // be the field itself or its parent. If is_different is provided,
+ // it is set to true if the top-level field is different from the
+ // field itself; otherwise it is set to false.
+ QPDF_DLL
+ QPDFFormFieldObjectHelper getTopLevelField(bool* is_different = nullptr);
+
// Get a field value, possibly inheriting the value from an
// ancestor node.
QPDF_DLL