crabbly / Print.js

A tiny javascript library to help printing from the web.
MIT License
4.28k stars 672 forks source link

Page spliting on print #672

Open eduuliana opened 1 year ago

eduuliana commented 1 year ago

I'm trying to print an HTML page, inside it the page size is set to 210mm x 110mm, media print also for the same size... but when printing it is dividing into two pages of the same size with the second one blank

Like the example in the picture below Does anyone know how to avoid this second page?

printOptions:

var printOptions: any = {
    printable: this.modeloFactura,
    type: 'raw-html',
    documentTitle: 'Factura',
    maxWidth: 210,
    maxHeight: 110,
    style: `
        @page { size: 210mm 110mm; margin: 0; }
        @media print { html, body { width: 210mm; height: 110mm; margin: 0; } }
        body > div, body, html { width: 99% ; height:99%; max-width:210mm ; max-height:110mm } `,
};

Sem título

semvis123 commented 10 months ago

Have you managed to fix the issue? I'm struggling with a similar problem.