Minor Changes in Invoice Creation

This commit is contained in:
2024-09-19 19:34:41 +02:00
parent c546e2cf3c
commit 93a2d96c21
2 changed files with 25 additions and 13 deletions

View File

@@ -595,6 +595,8 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
if(row.mode !== 'pagebreak' && row.mode !== 'title'){
console.log(row)
pages[pageCounter - 1].drawText(String(row.pos), {
...getCoordinatesForPDFLib(21,rowHeight, page1),
size:10,
@@ -613,19 +615,24 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
maxWidth: 240
})
pages[pageCounter - 1].drawText(row.text, {
pages[pageCounter - 1].drawText(row.text.match(/.{1,35}/g).join("\n"), {
...getCoordinatesForPDFLib(52,rowHeight, page1),
size:10,
color:rgb(0,0,0),
lineHeight:10,
opacity: 1,
maxWidth: 240,
maxWidth: 10,
font: fontBold
})
//let textLineBreaks = (row.text.match(/\n/g) || []).length
let textAutoLines = (row.text.match(/.{1,35}/g) || []).length
console.log(textAutoLines)
if(row.description) {
pages[pageCounter - 1].drawText(row.description, {
...getCoordinatesForPDFLib(52,rowHeight + 5, page1),
pages[pageCounter - 1].drawText(row.description.match(/.{1,70}/g).join("\n"), {
...getCoordinatesForPDFLib(52,rowHeight + ( textAutoLines * 4), page1),
size:10,
color:rgb(0,0,0),
lineHeight:10,
@@ -671,8 +678,8 @@ export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => {
if(row.description) {
let lineBreaks = (row.description.match(/\n/g) || []).length
let autoLines = (row.description.match(/.{1,50}/g) || []).length
rowHeight += 14 + (lineBreaks + autoLines) * 2.5
let autoLines = (row.description.match(/.{1,70}/g) || []).length
rowHeight += 14 + (lineBreaks + autoLines + textAutoLines) * 2.5
} else {
rowHeight += 10
}