Place invoice payment QR code bottom right

This commit is contained in:
2026-07-22 19:45:01 +02:00
parent fbea66b754
commit 5dcdc29a18

View File

@@ -981,32 +981,37 @@ export const createInvoicePDF = async (server:FastifyInstance, returnMode, invoi
color: rgb(0, 0, 0), color: rgb(0, 0, 0),
lineHeight: 10, lineHeight: 10,
opacity: 1, opacity: 1,
maxWidth: paymentQrCode ? 360 : 500 maxWidth: 500
}) })
}
if (paymentQrCode) { if (paymentQrCode) {
const qrSize = 32 * 2.83 const lastPage = pages[pages.length - 1]
const qrPosition = getCoordinatesForPDFLib(166, rowHeight + endTextDiff + (invoiceData.totalArray.length - 3) * 8 - 1, page1) const mm = 2.83
const qrSize = 32 * mm
const rightMargin = 20 * mm
const bottomMargin = 20 * mm
const qrX = lastPage.getWidth() - rightMargin - qrSize
const qrY = bottomMargin
pages[pageCounter - 1].drawText("Überweisung per QR-Code", { lastPage.drawText("Überweisung per QR-Code", {
y: qrPosition.y + qrSize + 7, x: qrX,
x: getCoordinatesForPDFLib(166, 0, page1).x, y: qrY + qrSize + 7,
size: 8, size: 8,
color: rgb(0, 0, 0), color: rgb(0, 0, 0),
lineHeight: 8, lineHeight: 8,
opacity: 1, opacity: 1,
maxWidth: 120, maxWidth: qrSize,
font: fontBold, font: fontBold,
}) })
pages[pageCounter - 1].drawImage(paymentQrCode, { lastPage.drawImage(paymentQrCode, {
x: qrPosition.x, x: qrX,
y: qrPosition.y, y: qrY,
width: qrSize, width: qrSize,
height: qrSize, height: qrSize,
}) })
} }
}
return await pdfDoc.saveAsBase64() return await pdfDoc.saveAsBase64()