1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #19110 from ryzokuken/autolink-demo

Enable automatic URL linking (bug 1019475)
This commit is contained in:
calixteman 2025-02-06 16:53:48 +01:00 committed by GitHub
commit 2d773cb773
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 656 additions and 14 deletions

View file

@ -3238,6 +3238,33 @@ class AnnotationLayer {
this.#setAnnotationCanvasMap();
}
/**
* Add link annotations to the annotation layer.
*
* @param {Array<Object>} annotations
* @param {IPDFLinkService} linkService
* @memberof AnnotationLayer
*/
async addLinkAnnotations(annotations, linkService) {
const elementParams = {
data: null,
layer: this.div,
linkService,
svgFactory: new DOMSVGFactory(),
parent: this,
};
for (const data of annotations) {
elementParams.data = data;
const element = AnnotationElementFactory.create(elementParams);
if (!element.isRenderable) {
continue;
}
const rendered = element.render();
await this.#appendElement(rendered, data.id);
}
}
/**
* Update the annotation elements on existing annotation layer.
*

View file

@ -24,9 +24,11 @@
import {
AbortException,
AnnotationBorderStyleType,
AnnotationEditorParamsType,
AnnotationEditorType,
AnnotationMode,
AnnotationType,
createValidAbsoluteUrl,
FeatureTest,
ImageKind,
@ -90,12 +92,14 @@ if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING || GENERIC")) {
export {
AbortException,
AnnotationBorderStyleType,
AnnotationEditorLayer,
AnnotationEditorParamsType,
AnnotationEditorType,
AnnotationEditorUIManager,
AnnotationLayer,
AnnotationMode,
AnnotationType,
build,
ColorPicker,
createValidAbsoluteUrl,