From 3b8ce4f12a75b34d890cb061a721e1a1240cddd1 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 31 Dec 2018 23:08:57 -0500 Subject: Annotation flattening including form fields Flatten annotations by integrating their appearance streams into the content stream of the containing page. In the case of form fields, only flatten if /NeedAppearance is false (or equivalently absent). If flattening form fields, also remove /AcroForm from the document catalog. --- include/qpdf/QPDFPageDocumentHelper.hh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include') diff --git a/include/qpdf/QPDFPageDocumentHelper.hh b/include/qpdf/QPDFPageDocumentHelper.hh index 52e03be8..d5446c16 100644 --- a/include/qpdf/QPDFPageDocumentHelper.hh +++ b/include/qpdf/QPDFPageDocumentHelper.hh @@ -31,6 +31,8 @@ #include +class QPDFAcroFormDocumentHelper; + class QPDFPageDocumentHelper: public QPDFDocumentHelper { public: @@ -84,7 +86,21 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper QPDF_DLL void removePage(QPDFPageObjectHelper page); + // For every annotation, integrate the annotation's appearance + // stream into the containing page's content streams, merge the + // annotation's resources with the page's resources, and remove + // the annotation from the page. Handles widget annotations + // associated with interactive form fields as a special case, + // including removing the /AcroForm key from the document catalog. + QPDF_DLL + void flattenAnnotations(); + private: + void flattenAnnotationsForPage( + QPDFPageObjectHelper& page, + QPDFObjectHandle& resources, + QPDFAcroFormDocumentHelper& afdh); + class Members { friend class QPDFPageDocumentHelper; -- cgit v1.2.3-70-g09d2