aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFPageDocumentHelper.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2023-12-29 19:35:29 +0100
committerJay Berkenbilt <ejb@ql.org>2023-12-29 19:40:08 +0100
commit78a7193fe2a5d14ca422407b35de9302f01d62ec (patch)
treee87127cfa310406c099fdd773d51f791392dc8a0 /libqpdf/QPDFPageDocumentHelper.cc
parent1ad6451e8c09b22fc45694eb4263efcff24c8afc (diff)
downloadqpdf-78a7193fe2a5d14ca422407b35de9302f01d62ec.tar.zst
Preserve annotations that inherently lack appearance (fixes #1039)
...when flattening annotations. This includes /Link, /Popup, and /Projection.
Diffstat (limited to 'libqpdf/QPDFPageDocumentHelper.cc')
-rw-r--r--libqpdf/QPDFPageDocumentHelper.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/libqpdf/QPDFPageDocumentHelper.cc b/libqpdf/QPDFPageDocumentHelper.cc
index c9c2cf52..1bfcf7ec 100644
--- a/libqpdf/QPDFPageDocumentHelper.cc
+++ b/libqpdf/QPDFPageDocumentHelper.cc
@@ -125,11 +125,12 @@ QPDFPageDocumentHelper::flattenAnnotationsForPage(
++next_fx;
}
new_content += content;
- } else if (process) {
- // If an annotation has no appearance stream, just drop the annotation when flattening.
- // This can happen for unchecked checkboxes and radio buttons, popup windows associated
- // with comments that aren't visible, and other types of annotations that aren't
- // visible.
+ } else if (process && !aoh.getAppearanceDictionary().isNull()) {
+ // If an annotation has no selected appearance stream, just drop the annotation when
+ // flattening. This can happen for unchecked checkboxes and radio buttons, popup windows
+ // associated with comments that aren't visible, and other types of annotations that
+ // aren't visible. Annotations that have no appearance streams at all, such as Link,
+ // Popup, and Projection, should be preserved.
QTC::TC("qpdf", "QPDFPageDocumentHelper ignore annotation with no appearance");
} else {
new_annots.push_back(aoh.getObjectHandle());