Place invoice payment QR code bottom right
This commit is contained in:
@@ -981,31 +981,36 @@ 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) {
|
||||||
|
const lastPage = pages[pages.length - 1]
|
||||||
|
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
|
||||||
|
|
||||||
|
lastPage.drawText("Überweisung per QR-Code", {
|
||||||
|
x: qrX,
|
||||||
|
y: qrY + qrSize + 7,
|
||||||
|
size: 8,
|
||||||
|
color: rgb(0, 0, 0),
|
||||||
|
lineHeight: 8,
|
||||||
|
opacity: 1,
|
||||||
|
maxWidth: qrSize,
|
||||||
|
font: fontBold,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (paymentQrCode) {
|
lastPage.drawImage(paymentQrCode, {
|
||||||
const qrSize = 32 * 2.83
|
x: qrX,
|
||||||
const qrPosition = getCoordinatesForPDFLib(166, rowHeight + endTextDiff + (invoiceData.totalArray.length - 3) * 8 - 1, page1)
|
y: qrY,
|
||||||
|
width: qrSize,
|
||||||
pages[pageCounter - 1].drawText("Überweisung per QR-Code", {
|
height: qrSize,
|
||||||
y: qrPosition.y + qrSize + 7,
|
})
|
||||||
x: getCoordinatesForPDFLib(166, 0, page1).x,
|
|
||||||
size: 8,
|
|
||||||
color: rgb(0, 0, 0),
|
|
||||||
lineHeight: 8,
|
|
||||||
opacity: 1,
|
|
||||||
maxWidth: 120,
|
|
||||||
font: fontBold,
|
|
||||||
})
|
|
||||||
|
|
||||||
pages[pageCounter - 1].drawImage(paymentQrCode, {
|
|
||||||
x: qrPosition.x,
|
|
||||||
y: qrPosition.y,
|
|
||||||
width: qrSize,
|
|
||||||
height: qrSize,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return await pdfDoc.saveAsBase64()
|
return await pdfDoc.saveAsBase64()
|
||||||
|
|||||||
Reference in New Issue
Block a user