Merge pull request #6827 from timvandermeij/highlight-annotation
Implement support for Highlight annotations
This commit is contained in:
commit
4e9ea35eee
@ -96,6 +96,9 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ {
|
|||||||
case 'Popup':
|
case 'Popup':
|
||||||
return new PopupAnnotation(parameters);
|
return new PopupAnnotation(parameters);
|
||||||
|
|
||||||
|
case 'Highlight':
|
||||||
|
return new HighlightAnnotation(parameters);
|
||||||
|
|
||||||
case 'Underline':
|
case 'Underline':
|
||||||
return new UnderlineAnnotation(parameters);
|
return new UnderlineAnnotation(parameters);
|
||||||
|
|
||||||
@ -795,6 +798,22 @@ var PopupAnnotation = (function PopupAnnotationClosure() {
|
|||||||
return PopupAnnotation;
|
return PopupAnnotation;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
var HighlightAnnotation = (function HighlightAnnotationClosure() {
|
||||||
|
function HighlightAnnotation(parameters) {
|
||||||
|
Annotation.call(this, parameters);
|
||||||
|
|
||||||
|
this.data.annotationType = AnnotationType.HIGHLIGHT;
|
||||||
|
this.data.hasHtml = true;
|
||||||
|
|
||||||
|
// PDF viewers completely ignore any border styles.
|
||||||
|
this.data.borderStyle.setWidth(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.inherit(HighlightAnnotation, Annotation, {});
|
||||||
|
|
||||||
|
return HighlightAnnotation;
|
||||||
|
})();
|
||||||
|
|
||||||
var UnderlineAnnotation = (function UnderlineAnnotationClosure() {
|
var UnderlineAnnotation = (function UnderlineAnnotationClosure() {
|
||||||
function UnderlineAnnotation(parameters) {
|
function UnderlineAnnotation(parameters) {
|
||||||
Annotation.call(this, parameters);
|
Annotation.call(this, parameters);
|
||||||
|
@ -72,6 +72,9 @@ AnnotationElementFactory.prototype =
|
|||||||
case AnnotationType.POPUP:
|
case AnnotationType.POPUP:
|
||||||
return new PopupAnnotationElement(parameters);
|
return new PopupAnnotationElement(parameters);
|
||||||
|
|
||||||
|
case AnnotationType.HIGHLIGHT:
|
||||||
|
return new HighlightAnnotationElement(parameters);
|
||||||
|
|
||||||
case AnnotationType.UNDERLINE:
|
case AnnotationType.UNDERLINE:
|
||||||
return new UnderlineAnnotationElement(parameters);
|
return new UnderlineAnnotationElement(parameters);
|
||||||
|
|
||||||
@ -609,6 +612,33 @@ var PopupElement = (function PopupElementClosure() {
|
|||||||
return PopupElement;
|
return PopupElement;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class
|
||||||
|
* @alias HighlightAnnotationElement
|
||||||
|
*/
|
||||||
|
var HighlightAnnotationElement = (
|
||||||
|
function HighlightAnnotationElementClosure() {
|
||||||
|
function HighlightAnnotationElement(parameters) {
|
||||||
|
AnnotationElement.call(this, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.inherit(HighlightAnnotationElement, AnnotationElement, {
|
||||||
|
/**
|
||||||
|
* Render the highlight annotation's HTML element in the empty container.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @memberof HighlightAnnotationElement
|
||||||
|
* @returns {HTMLSectionElement}
|
||||||
|
*/
|
||||||
|
render: function HighlightAnnotationElement_render() {
|
||||||
|
this.container.className = 'highlightAnnotation';
|
||||||
|
return this.container;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return HighlightAnnotationElement;
|
||||||
|
})();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
* @alias UnderlineAnnotationElement
|
* @alias UnderlineAnnotationElement
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -204,3 +204,4 @@
|
|||||||
!annotation-underline.pdf
|
!annotation-underline.pdf
|
||||||
!annotation-strikeout.pdf
|
!annotation-strikeout.pdf
|
||||||
!annotation-squiggly.pdf
|
!annotation-squiggly.pdf
|
||||||
|
!annotation-highlight.pdf
|
||||||
|
BIN
test/pdfs/annotation-highlight.pdf
Normal file
BIN
test/pdfs/annotation-highlight.pdf
Normal file
Binary file not shown.
@ -2667,6 +2667,13 @@
|
|||||||
"type": "eq",
|
"type": "eq",
|
||||||
"annotations": true
|
"annotations": true
|
||||||
},
|
},
|
||||||
|
{ "id": "annotation-highlight",
|
||||||
|
"file": "pdfs/annotation-highlight.pdf",
|
||||||
|
"md5": "e13e198e3a69c32dc9ebdc704d3105e1",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq",
|
||||||
|
"annotations": true
|
||||||
|
},
|
||||||
{ "id": "issue6108",
|
{ "id": "issue6108",
|
||||||
"file": "pdfs/issue6108.pdf",
|
"file": "pdfs/issue6108.pdf",
|
||||||
"md5": "8961cb55149495989a80bf0487e0f076",
|
"md5": "8961cb55149495989a80bf0487e0f076",
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
padding-top: 0.2em;
|
padding-top: 0.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.annotationLayer .highlightAnnotation,
|
||||||
.annotationLayer .underlineAnnotation,
|
.annotationLayer .underlineAnnotation,
|
||||||
.annotationLayer .squigglyAnnotation,
|
.annotationLayer .squigglyAnnotation,
|
||||||
.annotationLayer .strikeoutAnnotation {
|
.annotationLayer .strikeoutAnnotation {
|
||||||
|
Loading…
Reference in New Issue
Block a user