1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 07:38:07 +02:00

Merge pull request #8228 from timvandermeij/line-annotations

Implement support for line annotations
This commit is contained in:
Tim van der Meij 2017-04-13 00:18:31 +02:00 committed by GitHub
commit 32e01cda96
7 changed files with 139 additions and 24 deletions

View file

@ -269,6 +269,7 @@
!annotation-strikeout.pdf
!annotation-squiggly.pdf
!annotation-highlight.pdf
!annotation-line.pdf
!annotation-fileattachment.pdf
!annotation-text-widget.pdf
!annotation-choice-widget.pdf

BIN
test/pdfs/annotation-line.pdf Executable file

Binary file not shown.

View file

@ -3370,6 +3370,13 @@
"type": "eq",
"annotations": true
},
{ "id": "annotation-line",
"file": "pdfs/annotation-line.pdf",
"md5": "fde60608be2748f10fb6522cba425ca1",
"rounds": 1,
"type": "eq",
"annotations": true
},
{ "id": "annotation-fileattachment",
"file": "pdfs/annotation-fileattachment.pdf",
"md5": "d20ecee4b53c81b2dd44c8715a1b4a83",

View file

@ -1287,6 +1287,27 @@ describe('annotation', function() {
});
});
describe('LineAnnotation', function() {
it('should set the line coordinates', function() {
var lineDict = new Dict();
lineDict.set('Type', Name.get('Annot'));
lineDict.set('Subtype', Name.get('Line'));
lineDict.set('L', [1, 2, 3, 4]);
var lineRef = new Ref(122, 0);
var xref = new XRefMock([
{ ref: lineRef, data: lineDict, }
]);
var annotation = annotationFactory.create(xref, lineRef, pdfManagerMock,
idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(AnnotationType.LINE);
expect(data.lineCoordinates).toEqual([1, 2, 3, 4]);
});
});
describe('FileAttachmentAnnotation', function() {
it('should correctly parse a file attachment', function() {
var fileStream = new StringStream(