[GENERIC viewer] Fix printing regression from PR 13411

I missed this during review, since some of the changes in `web/pdf_print_service.js` broke printing.

Also, as part of these changes the patch replaces what looks like unnecessary `setAttribute` usage with "regular" `className` assignment and finally updates a couple of the CSS-rules to be more consistent.
This commit is contained in:
Jonas Jenwald 2021-06-02 21:37:49 +02:00
parent f2ade671ec
commit daf8461489
4 changed files with 7 additions and 9 deletions

View File

@ -34,7 +34,7 @@ function composePage(
canvas.height = Math.floor(size.height * PRINT_UNITS); canvas.height = Math.floor(size.height * PRINT_UNITS);
const canvasWrapper = document.createElement("div"); const canvasWrapper = document.createElement("div");
canvasWrapper.setAttribute("class", "printedPage"); canvasWrapper.className = "printedPage";
canvasWrapper.appendChild(canvas); canvasWrapper.appendChild(canvas);
printContainer.appendChild(canvasWrapper); printContainer.appendChild(canvasWrapper);

View File

@ -163,10 +163,8 @@ PDFPrintService.prototype = {
this._printResolution, this._printResolution,
this._optionalContentConfigPromise this._optionalContentConfigPromise
) )
.then(() => { .then(this.useRenderedPage.bind(this))
this.useRenderedPage.bind(this); .then(function () {
})
.then(() => {
renderNextPage(resolve, reject); renderNextPage(resolve, reject);
}, reject); }, reject);
}; };
@ -189,7 +187,7 @@ PDFPrintService.prototype = {
} }
const wrapper = document.createElement("div"); const wrapper = document.createElement("div");
wrapper.setAttribute("class", "printedPage"); wrapper.className = "printedPage";
wrapper.appendChild(img); wrapper.appendChild(img);
this.printContainer.appendChild(wrapper); this.printContainer.appendChild(wrapper);

View File

@ -1002,7 +1002,7 @@ function getXfaHtmlForPrinting(printContainer, pdfDocument) {
const scale = Math.round(CSS_UNITS * 100) / 100; const scale = Math.round(CSS_UNITS * 100) / 100;
for (const xfaPage of xfaHtml.children) { for (const xfaPage of xfaHtml.children) {
const page = document.createElement("div"); const page = document.createElement("div");
page.setAttribute("class", "xfaPrintedPage"); page.className = "xfaPrintedPage";
printContainer.appendChild(page); printContainer.appendChild(page);
const { width, height } = xfaPage.attributes.style; const { width, height } = xfaPage.attributes.style;

View File

@ -1839,8 +1839,8 @@ html[dir="rtl"] #documentPropertiesOverlay .row > * {
position: relative; position: relative;
} }
.printedPage canvas, #printContainer > .printedPage canvas,
.printedPage img { #printContainer > .printedPage img {
/* The intrinsic canvas / image size will make sure that we fit the page. */ /* The intrinsic canvas / image size will make sure that we fit the page. */
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;