Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle appending consistently in the xfaLayer regardless of rendering intent (PR 17177 follow-up) #17184

Merged
merged 1 commit into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion web/pdf_page_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,6 @@ class PDFPageView {
const { annotationStorage, linkService } = this.#layerProperties;

this.xfaLayer = new XfaLayerBuilder({
pageDiv: div,
pdfPage,
annotationStorage,
linkService,
Expand Down
2 changes: 1 addition & 1 deletion web/print_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function getXfaHtmlForPrinting(printContainer, pdfDocument) {
printContainer.append(page);

const builder = new XfaLayerBuilder({
pageDiv: page,
pdfPage: null,
annotationStorage: pdfDocument.annotationStorage,
linkService,
Expand All @@ -37,6 +36,7 @@ function getXfaHtmlForPrinting(printContainer, pdfDocument) {
const viewport = getXfaPageViewport(xfaPage, { scale });

builder.render(viewport, "print");
page.append(builder.div);
}
}

Expand Down
8 changes: 2 additions & 6 deletions web/xfa_layer_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { XfaLayer } from "pdfjs-lib";

/**
* @typedef {Object} XfaLayerBuilderOptions
* @property {HTMLDivElement} pageDiv
* @property {PDFPageProxy} pdfPage
* @property {AnnotationStorage} [annotationStorage]
* @property {IPDFLinkService} linkService
Expand All @@ -36,13 +35,11 @@ class XfaLayerBuilder {
* @param {XfaLayerBuilderOptions} options
*/
constructor({
pageDiv,
pdfPage,
annotationStorage = null,
linkService,
xfaHtml = null,
}) {
this.pageDiv = pageDiv;
this.pdfPage = pdfPage;
this.annotationStorage = annotationStorage;
this.linkService = linkService;
Expand Down Expand Up @@ -71,9 +68,8 @@ class XfaLayerBuilder {
};

// Create an xfa layer div and render the form
const div = document.createElement("div");
this.pageDiv.append(div);
parameters.div = div;
this.div = document.createElement("div");
parameters.div = this.div;

return XfaLayer.render(parameters);
}
Expand Down