Browse Source

Merge pull request #4080 from Snuffleupagus/bug-957034

Fix annotation border issue (bug 957034)
Yury Delendik 11 years ago
parent
commit
95a7be0df4
  1. 23
      src/shared/annotation.js

23
src/shared/annotation.js

@ -98,6 +98,29 @@ var Annotation = (function AnnotationClosure() {
} else { } else {
var borderArray = dict.get('Border') || [0, 0, 1]; var borderArray = dict.get('Border') || [0, 0, 1];
data.borderWidth = borderArray[2] || 0; data.borderWidth = borderArray[2] || 0;
// TODO: implement proper support for annotations with line dash patterns.
var dashArray = borderArray[3];
if (dashArray && isArray(dashArray)) {
var dashArrayLength = dashArray.length;
if (dashArrayLength > 0) {
// According to the PDF specification: the elements in a dashArray
// shall be numbers that are nonnegative and not all equal to zero.
var isInvalid = false;
var numPositive = 0;
for (var i = 0; i < dashArrayLength; i++) {
if (!(+dashArray[i] >= 0)) {
isInvalid = true;
break;
} else if (dashArray[i] > 0) {
numPositive++;
}
}
if (isInvalid || numPositive === 0) {
data.borderWidth = 0;
}
}
}
} }
this.appearance = getDefaultAppearance(dict); this.appearance = getDefaultAppearance(dict);

Loading…
Cancel
Save