Handle more cases of invalid line dash patterns in annotation borders

This commit is contained in:
Jonas Jenwald 2014-05-09 23:12:23 +02:00
parent e359f0694f
commit 67a3b59864

View File

@ -105,7 +105,12 @@ var Annotation = (function AnnotationClosure() {
// TODO: implement proper support for annotations with line dash patterns.
var dashArray = borderArray[3];
if (data.borderWidth > 0 && dashArray && isArray(dashArray)) {
if (data.borderWidth > 0 && dashArray) {
if (!isArray(dashArray)) {
// Ignore the border if dashArray is not actually an array,
// this is consistent with the behaviour in Adobe Reader.
data.borderWidth = 0;
} else {
var dashArrayLength = dashArray.length;
if (dashArrayLength > 0) {
// According to the PDF specification: the elements in a dashArray
@ -127,6 +132,7 @@ var Annotation = (function AnnotationClosure() {
}
}
}
}
this.appearance = getDefaultAppearance(dict);
data.hasAppearance = !!this.appearance;