Skip to content

Commit

Permalink
Merge pull request mozilla#17184 from Snuffleupagus/xfaLayer-append-p…
Browse files Browse the repository at this point in the history
…rint

Handle appending consistently in the xfaLayer regardless of rendering intent (PR 17177 follow-up)
  • Loading branch information
Snuffleupagus authored Oct 28, 2023
2 parents b798415 + 097f214 commit 80612f3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
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

0 comments on commit 80612f3

Please sign in to comment.