mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Ensure that various URL-related options are applied in the xfaLayer
too
Note how both the annotationLayer and the document outline will apply various URL-related options when creating the link-elements. For consistency the `xfaLayer`-rendering should obviously use the same options, to ensure that the existing options are indeed applied to all URLs regardless of where they originate.
This commit is contained in:
parent
284d259054
commit
bb9c905c5d
7 changed files with 53 additions and 9 deletions
|
@ -1358,6 +1358,7 @@ class BaseViewer {
|
|||
* @param {PDFPage} pdfPage
|
||||
* @param {AnnotationStorage} [annotationStorage] - Storage for annotation
|
||||
* data in forms.
|
||||
* @property {IPDFLinkService} linkService
|
||||
* @returns {XfaLayerBuilder}
|
||||
*/
|
||||
createXfaLayerBuilder(pageDiv, pdfPage, annotationStorage = null) {
|
||||
|
@ -1366,6 +1367,7 @@ class BaseViewer {
|
|||
pdfPage,
|
||||
annotationStorage:
|
||||
annotationStorage || this.pdfDocument?.annotationStorage,
|
||||
linkService: this.linkService,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -191,9 +191,16 @@ class IPDFXfaLayerFactory {
|
|||
/**
|
||||
* @param {HTMLDivElement} pageDiv
|
||||
* @param {PDFPage} pdfPage
|
||||
* @param {AnnotationStorage} [annotationStorage]
|
||||
* @param {Object} [xfaHtml]
|
||||
* @returns {XfaLayerBuilder}
|
||||
*/
|
||||
createXfaLayerBuilder(pageDiv, pdfPage) {}
|
||||
createXfaLayerBuilder(
|
||||
pageDiv,
|
||||
pdfPage,
|
||||
annotationStorage = null,
|
||||
xfaHtml = null
|
||||
) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
/** @typedef {import("./interfaces").IPDFXfaLayerFactory} IPDFXfaLayerFactory */
|
||||
|
||||
import { SimpleLinkService } from "./pdf_link_service.js";
|
||||
import { XfaLayer } from "pdfjs-lib";
|
||||
|
||||
/**
|
||||
|
@ -22,6 +23,7 @@ import { XfaLayer } from "pdfjs-lib";
|
|||
* @property {HTMLDivElement} pageDiv
|
||||
* @property {PDFPage} pdfPage
|
||||
* @property {AnnotationStorage} [annotationStorage]
|
||||
* @property {IPDFLinkService} linkService
|
||||
* @property {Object} [xfaHtml]
|
||||
*/
|
||||
|
||||
|
@ -29,10 +31,11 @@ class XfaLayerBuilder {
|
|||
/**
|
||||
* @param {XfaLayerBuilderOptions} options
|
||||
*/
|
||||
constructor({ pageDiv, pdfPage, annotationStorage, xfaHtml }) {
|
||||
constructor({ pageDiv, pdfPage, annotationStorage, linkService, xfaHtml }) {
|
||||
this.pageDiv = pageDiv;
|
||||
this.pdfPage = pdfPage;
|
||||
this.annotationStorage = annotationStorage;
|
||||
this.linkService = linkService;
|
||||
this.xfaHtml = xfaHtml;
|
||||
|
||||
this.div = null;
|
||||
|
@ -54,6 +57,7 @@ class XfaLayerBuilder {
|
|||
xfa: this.xfaHtml,
|
||||
page: null,
|
||||
annotationStorage: this.annotationStorage,
|
||||
linkService: this.linkService,
|
||||
intent,
|
||||
};
|
||||
|
||||
|
@ -80,6 +84,7 @@ class XfaLayerBuilder {
|
|||
xfa,
|
||||
page: this.pdfPage,
|
||||
annotationStorage: this.annotationStorage,
|
||||
linkService: this.linkService,
|
||||
intent,
|
||||
};
|
||||
|
||||
|
@ -129,6 +134,7 @@ class DefaultXfaLayerFactory {
|
|||
pageDiv,
|
||||
pdfPage,
|
||||
annotationStorage,
|
||||
linkService: new SimpleLinkService(),
|
||||
xfaHtml,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue