schoero / swissqrbill

Swiss QR Bill generation in Node.js and browsers
MIT License
155 stars 29 forks source link

Add the QR slip in an A4 pages #438

Closed popod closed 3 months ago

popod commented 3 months ago

Hi,

When generating the complete qr bill with a long table, the QR slip is added to a new page. But the new page is not in A4 format.. How to add the QR slip in a new A4 page ?

Thank you

schoero commented 3 months ago

There is no option to change this, but you can use SwissQRBill.isSpaceSufficient to calculate if there is sufficient space on the current page and add a page manually if necessary.

if (!SwissQRBill.isSpaceSufficient(pdf, 0, pdf.y)) {
  pdf.addPage({ size: 'A4' });
}

Working example: stackblitz.com

popod commented 3 months ago

Hi @schoero

Thank you for your fast reply ! This is perfect :)

I think that adding that to the full bill exemple could be great.