Skip to content

Commit ec1633c

Browse files
Merge pull request #14201 from Snuffleupagus/bug-1219400
Use the correct border-style for Annotations, when a dash array is specified (bug 1219400)
2 parents 317e4dd + 884caf6 commit ec1633c

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/core/annotation.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ class Annotation {
660660

661661
if (array.length === 4) {
662662
// Dash array available
663-
this.borderStyle.setDashArray(array[3]);
663+
this.borderStyle.setDashArray(array[3], /* forceStyle = */ true);
664664
}
665665
}
666666
} else {
@@ -981,8 +981,9 @@ class AnnotationBorderStyle {
981981
* @public
982982
* @memberof AnnotationBorderStyle
983983
* @param {Array} dashArray - The dash array with at least one element
984+
* @param {boolean} [forceStyle]
984985
*/
985-
setDashArray(dashArray) {
986+
setDashArray(dashArray, forceStyle = false) {
986987
// We validate the dash array, but we do not use it because CSS does not
987988
// allow us to change spacing of dashes. For more information, visit
988989
// http://www.w3.org/TR/css3-background/#the-border-style.
@@ -1002,6 +1003,12 @@ class AnnotationBorderStyle {
10021003
}
10031004
if (isValid && !allZeros) {
10041005
this.dashArray = dashArray;
1006+
1007+
if (forceStyle) {
1008+
// Even though we cannot use the dash array in the display layer,
1009+
// at least ensure that we use the correct border-style.
1010+
this.setStyle(Name.get("D"));
1011+
}
10051012
} else {
10061013
this.width = 0; // Adobe behavior when the array is invalid.
10071014
}

test/pdfs/bug1219400.pdf.link

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://web.archive.org/web/20160212224934/http://www.ghostscript.com/doc/examples/annots.pdf

test/test_manifest.json

+9
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,15 @@
18221822
"link": false,
18231823
"type": "eq"
18241824
},
1825+
{ "id": "bug1219400",
1826+
"file": "pdfs/bug1219400.pdf",
1827+
"md5": "a1554914cc9653d5ee0b9220657b334f",
1828+
"rounds": 1,
1829+
"link": true,
1830+
"lastPage": 1,
1831+
"type": "eq",
1832+
"annotations": true
1833+
},
18251834
{ "id": "bug1245391",
18261835
"file": "pdfs/bug1245391_reduced.pdf",
18271836
"md5": "6c946045ee0f2f663f269717c0f1614a",

0 commit comments

Comments
 (0)