rpg-cards icon indicating copy to clipboard operation
rpg-cards copied to clipboard

Landscape printout wrongly rotated and cut off

Open pcdi opened this issue 11 months ago • 0 comments

If a landscape orientation for the page size is selected, the cards are displayed correctly in the output, however the printout is wrong, as the page is turned again (see fig. 3).

Page size settings: Page size settings

Generated output: Output

Page as seen in the browser print dialog: Print dialog

The error seems to lie in this function:

https://github.com/crobi/rpg-cards/blob/e449f5559d9940df795bd21fc52ec6defbd293e3/generator/js/cards.js#L743-L755

For landscape printouts, pw and ph need to be switched around. You can test this by opening developer tools on the generated output and switching around the two values in /html/body/div/style:

Change

@page {
    margin: 0;
    size:297mm 210mm;
    -webkit-print-color-adjust: exact;
}

to

@page {
    margin: 0;
    size:210mm 297mm;
    -webkit-print-color-adjust: exact;
}

The generated output looks the same, but now the print preview shows the correct orientation.

pcdi avatar Feb 28 '24 13:02 pcdi