|
|
|
@ -689,6 +689,36 @@ describe('annotation', function() {
@@ -689,6 +689,36 @@ describe('annotation', function() {
|
|
|
|
|
expect(data.dest).toEqual([{ num: 17, gen: 0, }, { name: 'XYZ', }, |
|
|
|
|
0, 841.89, null]); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('should correctly parse a Dest, which violates the specification ' + |
|
|
|
|
'by containing a dictionary', function() { |
|
|
|
|
let destDict = new Dict(); |
|
|
|
|
destDict.set('Type', Name.get('Action')); |
|
|
|
|
destDict.set('S', Name.get('GoTo')); |
|
|
|
|
destDict.set('D', 'page.157'); |
|
|
|
|
|
|
|
|
|
let annotationDict = new Dict(); |
|
|
|
|
annotationDict.set('Type', Name.get('Annot')); |
|
|
|
|
annotationDict.set('Subtype', Name.get('Link')); |
|
|
|
|
// The /Dest must be a Name or an Array, refer to ISO 32000-1:2008
|
|
|
|
|
// section 12.3.3, but there are PDF files where it's a dictionary.
|
|
|
|
|
annotationDict.set('Dest', destDict); |
|
|
|
|
|
|
|
|
|
let annotationRef = new Ref(798, 0); |
|
|
|
|
let xref = new XRefMock([ |
|
|
|
|
{ ref: annotationRef, data: annotationDict, } |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
let annotation = annotationFactory.create(xref, annotationRef, |
|
|
|
|
pdfManagerMock, idFactoryMock); |
|
|
|
|
let data = annotation.data; |
|
|
|
|
expect(data.annotationType).toEqual(AnnotationType.LINK); |
|
|
|
|
|
|
|
|
|
expect(data.url).toBeUndefined(); |
|
|
|
|
expect(data.unsafeUrl).toBeUndefined(); |
|
|
|
|
expect(data.dest).toEqual('page.157'); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
describe('WidgetAnnotation', function() { |
|
|
|
|