PDFJsAnnotations
PDFJsAnnotations copied to clipboard
Enable annotation layer (text and link)
How can the annotation layer be enabled in pdf.js being used? When try something like following:
var promise = page.getAnnotations().then(function (annotationsData) {
viewport = viewport.clone({
dontFlip: true
});
for (var i = 0; i < annotationsData.length; i++) {
var data = annotationsData[i];
var annotation = PDFJS.Annotation.fromData(data);
if (!annotation || !annotation.hasHtml()) {
continue;
}
//. . . . code continues
This won't work, as it will break at PDFJS.Annotation.fromData(data)
because PDFJS
is no more available from version 2.0 onwards.
What I'm trying to do:
My goal is to enable links in pdf. for example, there are some links that point to a specific page within the same pdf document. Currently they aren't enabled. I tried to search and found that it could be enabled by enabling the annotation layer. But all examples I found related to enabling annotation layer are using PDFJS
instance. Any help would be appreciated.