diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-01-21 02:40:56 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-01-21 05:05:58 +0100 |
commit | 65ef0bf3130b69c8d48181ab27688567535f2d9f (patch) | |
tree | c28c260ab89427e5401511c43f363892a52fda9d /libqpdf | |
parent | 85f70cae2365b30474d2c5640101960b82488c71 (diff) | |
download | qpdf-65ef0bf3130b69c8d48181ab27688567535f2d9f.tar.zst |
When flattening, remove annotations with no appearance stream
With the exception of form field annotations when /NeedAppearances is
true, remove annotations that don't have appearance streams when
flattening. There is no reason to keep these when flattening since
they are invisible. This may include unchecked checkboxes, unshown
popup windows, etc.
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDFPageDocumentHelper.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libqpdf/QPDFPageDocumentHelper.cc b/libqpdf/QPDFPageDocumentHelper.cc index 1dacd672..fa50c471 100644 --- a/libqpdf/QPDFPageDocumentHelper.cc +++ b/libqpdf/QPDFPageDocumentHelper.cc @@ -141,11 +141,7 @@ QPDFPageDocumentHelper::flattenAnnotationsForPage( QTC::TC("qpdf", "QPDFPageDocumentHelper skip widget need appearances"); process = false; } - if (process && (! as.isStream())) - { - process = false; - } - if (process) + if (process && as.isStream()) { if (is_widget) { @@ -200,6 +196,15 @@ QPDFPageDocumentHelper::flattenAnnotationsForPage( } 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. + QTC::TC("qpdf", "QPDFPageDocumentHelper ignore annotation with no appearance"); + } else { new_annots.push_back(aoh.getObjectHandle()); |