Don't take into account the INVISIBLE flag for well-known annotations
This commit is contained in:
parent
f098121644
commit
133ed96f8f
@ -838,6 +838,17 @@ class Annotation {
|
||||
*/
|
||||
setFlags(flags) {
|
||||
this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
|
||||
if (
|
||||
this.flags & AnnotationFlag.INVISIBLE &&
|
||||
this.constructor.name !== "Annotation"
|
||||
) {
|
||||
// From the pdf spec v1.7, section 12.5.3 (Annotation Flags):
|
||||
// If set, do not display the annotation if it does not belong to one of
|
||||
// the standard annotation types and no annotation handler is available.
|
||||
//
|
||||
// So we can remove the flag in case we have a known annotation type.
|
||||
this.flags ^= AnnotationFlag.INVISIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1817,7 +1828,9 @@ class WidgetAnnotation extends Annotation {
|
||||
// since the visibility can be changed by js code, hence in case
|
||||
// it's made viewable, we should render it (with visibility set to
|
||||
// hidden).
|
||||
return !this._hasFlag(flags, AnnotationFlag.INVISIBLE);
|
||||
// We don't take into account the `INVISIBLE` flag here, since we've a known
|
||||
// annotation type.
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
|
1
test/pdfs/issue17169.pdf.link
Normal file
1
test/pdfs/issue17169.pdf.link
Normal file
@ -0,0 +1 @@
|
||||
https://github.com/mozilla/pdf.js/files/13161366/stamp-signature.pdf
|
@ -8181,5 +8181,13 @@
|
||||
"lastPage": 2,
|
||||
"type": "eq",
|
||||
"forms": true
|
||||
},
|
||||
{
|
||||
"id": "issue17169",
|
||||
"file": "pdfs/issue17169.pdf",
|
||||
"md5": "fa57aa9442c5e2d6d9e61bbb8856a55f",
|
||||
"link": true,
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
}
|
||||
]
|
||||
|
@ -4082,7 +4082,7 @@ describe("annotation", function () {
|
||||
const popupDict = new Dict();
|
||||
popupDict.set("Type", Name.get("Annot"));
|
||||
popupDict.set("Subtype", Name.get("Popup"));
|
||||
popupDict.set("F", 25); // not viewable
|
||||
popupDict.set("F", 56); // not viewable
|
||||
popupDict.set("Parent", parentDict);
|
||||
|
||||
const popupRef = Ref.get(13, 0);
|
||||
@ -4097,7 +4097,7 @@ describe("annotation", function () {
|
||||
expect(data.annotationType).toEqual(AnnotationType.POPUP);
|
||||
// We should not modify the `annotationFlags` returned through
|
||||
// e.g., the API.
|
||||
expect(data.annotationFlags).toEqual(25);
|
||||
expect(data.annotationFlags).toEqual(56);
|
||||
// The popup should inherit the `viewable` property of the parent.
|
||||
expect(viewable).toEqual(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user