mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
Merge pull request #17908 from calixteman/issue17906
Don't render annotations with a null dimension
This commit is contained in:
commit
2c7ae50c4b
3 changed files with 25 additions and 5 deletions
|
@ -1119,11 +1119,20 @@ class Annotation {
|
|||
renderForms,
|
||||
annotationStorage
|
||||
) {
|
||||
const data = this.data;
|
||||
const { hasOwnCanvas, id, rect } = this.data;
|
||||
let appearance = this.appearance;
|
||||
const isUsingOwnCanvas = !!(
|
||||
this.data.hasOwnCanvas && intent & RenderingIntentFlag.DISPLAY
|
||||
hasOwnCanvas && intent & RenderingIntentFlag.DISPLAY
|
||||
);
|
||||
if (isUsingOwnCanvas && (rect[0] === rect[2] || rect[1] === rect[3])) {
|
||||
// Empty annotation, don't draw anything.
|
||||
this.data.hasOwnCanvas = false;
|
||||
return {
|
||||
opList: new OperatorList(),
|
||||
separateForm: false,
|
||||
separateCanvas: false,
|
||||
};
|
||||
}
|
||||
if (!appearance) {
|
||||
if (!isUsingOwnCanvas) {
|
||||
return {
|
||||
|
@ -1143,7 +1152,7 @@ class Annotation {
|
|||
);
|
||||
const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
|
||||
const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
|
||||
const transform = getTransformMatrix(data.rect, bbox, matrix);
|
||||
const transform = getTransformMatrix(rect, bbox, matrix);
|
||||
|
||||
const opList = new OperatorList();
|
||||
|
||||
|
@ -1159,8 +1168,8 @@ class Annotation {
|
|||
}
|
||||
|
||||
opList.addOp(OPS.beginAnnotation, [
|
||||
data.id,
|
||||
data.rect,
|
||||
id,
|
||||
rect,
|
||||
transform,
|
||||
matrix,
|
||||
isUsingOwnCanvas,
|
||||
|
|
1
test/pdfs/issue17906.pdf.link
Normal file
1
test/pdfs/issue17906.pdf.link
Normal file
|
@ -0,0 +1 @@
|
|||
https://web.archive.org/web/20240408171222/https://www.myconsumers.org/docs/default-source/default-document-library/consumer_fee_schedule3cb1f27b220b46e38278186d8f609a23fc8e3ea533ad421d8caf5ccbd8df1cb5.pdf
|
|
@ -9823,5 +9823,15 @@
|
|||
"md5": "07d95eabf18aee0cf38f09eb7b1390ec",
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{
|
||||
"id": "issue17906",
|
||||
"file": "pdfs/issue17906.pdf",
|
||||
"md5": "f81c617e5113e0c510a4cfe8b012798e",
|
||||
"rounds": 1,
|
||||
"link": true,
|
||||
"firstPage": 1,
|
||||
"lastPage": 1,
|
||||
"type": "eq"
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue