Handle appending consistently in the xfaLayer regardless of rendering intent (PR 17177 follow-up)
After PR 17177 the interface of `XfaLayerBuilder` is now inconsistent, since whether or not we directly append the xfaLayer to the DOM now depends on the rendering intent.
This commit is contained in:
parent
fbfacf8828
commit
097f214222
@ -1026,7 +1026,6 @@ class PDFPageView {
|
|||||||
const { annotationStorage, linkService } = this.#layerProperties;
|
const { annotationStorage, linkService } = this.#layerProperties;
|
||||||
|
|
||||||
this.xfaLayer = new XfaLayerBuilder({
|
this.xfaLayer = new XfaLayerBuilder({
|
||||||
pageDiv: div,
|
|
||||||
pdfPage,
|
pdfPage,
|
||||||
annotationStorage,
|
annotationStorage,
|
||||||
linkService,
|
linkService,
|
||||||
|
@ -28,7 +28,6 @@ function getXfaHtmlForPrinting(printContainer, pdfDocument) {
|
|||||||
printContainer.append(page);
|
printContainer.append(page);
|
||||||
|
|
||||||
const builder = new XfaLayerBuilder({
|
const builder = new XfaLayerBuilder({
|
||||||
pageDiv: page,
|
|
||||||
pdfPage: null,
|
pdfPage: null,
|
||||||
annotationStorage: pdfDocument.annotationStorage,
|
annotationStorage: pdfDocument.annotationStorage,
|
||||||
linkService,
|
linkService,
|
||||||
@ -37,6 +36,7 @@ function getXfaHtmlForPrinting(printContainer, pdfDocument) {
|
|||||||
const viewport = getXfaPageViewport(xfaPage, { scale });
|
const viewport = getXfaPageViewport(xfaPage, { scale });
|
||||||
|
|
||||||
builder.render(viewport, "print");
|
builder.render(viewport, "print");
|
||||||
|
page.append(builder.div);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ import { XfaLayer } from "pdfjs-lib";
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} XfaLayerBuilderOptions
|
* @typedef {Object} XfaLayerBuilderOptions
|
||||||
* @property {HTMLDivElement} pageDiv
|
|
||||||
* @property {PDFPageProxy} pdfPage
|
* @property {PDFPageProxy} pdfPage
|
||||||
* @property {AnnotationStorage} [annotationStorage]
|
* @property {AnnotationStorage} [annotationStorage]
|
||||||
* @property {IPDFLinkService} linkService
|
* @property {IPDFLinkService} linkService
|
||||||
@ -36,13 +35,11 @@ class XfaLayerBuilder {
|
|||||||
* @param {XfaLayerBuilderOptions} options
|
* @param {XfaLayerBuilderOptions} options
|
||||||
*/
|
*/
|
||||||
constructor({
|
constructor({
|
||||||
pageDiv,
|
|
||||||
pdfPage,
|
pdfPage,
|
||||||
annotationStorage = null,
|
annotationStorage = null,
|
||||||
linkService,
|
linkService,
|
||||||
xfaHtml = null,
|
xfaHtml = null,
|
||||||
}) {
|
}) {
|
||||||
this.pageDiv = pageDiv;
|
|
||||||
this.pdfPage = pdfPage;
|
this.pdfPage = pdfPage;
|
||||||
this.annotationStorage = annotationStorage;
|
this.annotationStorage = annotationStorage;
|
||||||
this.linkService = linkService;
|
this.linkService = linkService;
|
||||||
@ -71,9 +68,8 @@ class XfaLayerBuilder {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create an xfa layer div and render the form
|
// Create an xfa layer div and render the form
|
||||||
const div = document.createElement("div");
|
this.div = document.createElement("div");
|
||||||
this.pageDiv.append(div);
|
parameters.div = this.div;
|
||||||
parameters.div = div;
|
|
||||||
|
|
||||||
return XfaLayer.render(parameters);
|
return XfaLayer.render(parameters);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user