summaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFAnnotationObjectHelper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/QPDFAnnotationObjectHelper.cc')
-rw-r--r--libqpdf/QPDFAnnotationObjectHelper.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/libqpdf/QPDFAnnotationObjectHelper.cc b/libqpdf/QPDFAnnotationObjectHelper.cc
index c14d98f9..ff985ed0 100644
--- a/libqpdf/QPDFAnnotationObjectHelper.cc
+++ b/libqpdf/QPDFAnnotationObjectHelper.cc
@@ -54,7 +54,14 @@ QPDFAnnotationObjectHelper::getAppearanceStream(
std::string desired_state = state.empty() ? getAppearanceState() : state;
if (ap.isDictionary()) {
QPDFObjectHandle ap_sub = ap.getKey(which);
- if (ap_sub.isStream() && desired_state.empty()) {
+ if (ap_sub.isStream()) {
+ // According to the spec, Appearance State is supposed to
+ // refer to a subkey of the appearance stream when /AP is
+ // a dictionary, but files have been seen in the wild
+ // where Appearance State is `/N` and `/AP` is a stream.
+ // Therefore, if `which` points to a stream, disregard
+ // state and just use the stream. See qpdf issue #949 for
+ // details.
QTC::TC("qpdf", "QPDFAnnotationObjectHelper AP stream");
return ap_sub;
}