Implement rendering line annotations without appearance stream
This commit is contained in:
parent
d6e0b2d92e
commit
5828ff6cb0
@ -2280,9 +2280,34 @@ class LineAnnotation extends MarkupAnnotation {
|
|||||||
|
|
||||||
this.data.annotationType = AnnotationType.LINE;
|
this.data.annotationType = AnnotationType.LINE;
|
||||||
|
|
||||||
this.data.lineCoordinates = Util.normalizeRect(
|
const lineCoordinates = parameters.dict.getArray("L");
|
||||||
parameters.dict.getArray("L")
|
this.data.lineCoordinates = Util.normalizeRect(lineCoordinates);
|
||||||
);
|
|
||||||
|
if (!this.appearance) {
|
||||||
|
// The default stroke color is black.
|
||||||
|
const strokeColor = this.color
|
||||||
|
? Array.from(this.color).map(c => c / 255)
|
||||||
|
: [0, 0, 0];
|
||||||
|
|
||||||
|
const borderWidth = this.borderStyle.width;
|
||||||
|
|
||||||
|
this._setDefaultAppearance({
|
||||||
|
xref: parameters.xref,
|
||||||
|
extra: `${borderWidth} w`,
|
||||||
|
strokeColor,
|
||||||
|
pointsCallback: (buffer, points) => {
|
||||||
|
buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`);
|
||||||
|
buffer.push(`${lineCoordinates[2]} ${lineCoordinates[3]} l`);
|
||||||
|
buffer.push("S");
|
||||||
|
return [
|
||||||
|
points[0].x - borderWidth,
|
||||||
|
points[1].x + borderWidth,
|
||||||
|
points[3].y - borderWidth,
|
||||||
|
points[1].y + borderWidth,
|
||||||
|
];
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -393,6 +393,7 @@
|
|||||||
!issue12418_reduced.pdf
|
!issue12418_reduced.pdf
|
||||||
!annotation-freetext.pdf
|
!annotation-freetext.pdf
|
||||||
!annotation-line.pdf
|
!annotation-line.pdf
|
||||||
|
!annotation-line-without-appearance.pdf
|
||||||
!bug1669099.pdf
|
!bug1669099.pdf
|
||||||
!annotation-square-circle.pdf
|
!annotation-square-circle.pdf
|
||||||
!annotation-square-circle-without-appearance.pdf
|
!annotation-square-circle-without-appearance.pdf
|
||||||
|
BIN
test/pdfs/annotation-line-without-appearance.pdf
Normal file
BIN
test/pdfs/annotation-line-without-appearance.pdf
Normal file
Binary file not shown.
@ -4717,6 +4717,13 @@
|
|||||||
"type": "eq",
|
"type": "eq",
|
||||||
"annotations": true
|
"annotations": true
|
||||||
},
|
},
|
||||||
|
{ "id": "annotation-line-without-appearance",
|
||||||
|
"file": "pdfs/annotation-line-without-appearance.pdf",
|
||||||
|
"md5": "1f60935b2a7719ce40616af60fc308a2",
|
||||||
|
"rounds": 1,
|
||||||
|
"annotations": true,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "annotation-square-circle",
|
{ "id": "annotation-square-circle",
|
||||||
"file": "pdfs/annotation-square-circle.pdf",
|
"file": "pdfs/annotation-square-circle.pdf",
|
||||||
"md5": "cfd3c302f68d61e1d55ed9c7896046c3",
|
"md5": "cfd3c302f68d61e1d55ed9c7896046c3",
|
||||||
|
Loading…
Reference in New Issue
Block a user