From 4bd977ed1234410786b2eda3e3eca11add5b4623 Mon Sep 17 00:00:00 2001 From: seb Date: Sat, 17 Oct 2026 22:26:02 +0200 Subject: [PATCH] u --- src/services/manifestPdf.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/services/manifestPdf.js b/src/services/manifestPdf.js index b4efcf7..bf790d0 100644 --- a/src/services/manifestPdf.js +++ b/src/services/manifestPdf.js @@ -248,6 +248,12 @@ export function generateManifestPdf({ .fillColor(secondaryColor) .text(config.docTitle, 350, y, { align: 'right', width: 200 }); + if (type === 'delivery') { + try { + doc.initForm(); + } catch (_) { } + } + y += 24; // Company subline @@ -581,12 +587,25 @@ export function generateManifestPdf({ doc.font('Helvetica').fontSize(7.5).fillColor(textColor) .text(nameText, colDeliv.name, y + 6, { width: colDeliv.nameW }); - // 7. Checkbox outline (to cross with pencil) - left of geliefert + // 7. Checkbox (interactive PDF form field, checkable in PDF Reader) doc.rect(colDeliv.check + 3, centerY - 1, 12, 12) .strokeColor('#64748b') .lineWidth(0.8) .stroke(); + try { + const checkFieldName = `check_${line.id ? line.id : index + 1}`; + doc.formCheckbox(checkFieldName, colDeliv.check + 3, centerY - 1, 12, 12, { + borderColor: '#64748b', + backgroundColor: '#ffffff', + }); + const lastAnnot = doc.page.annotations[doc.page.annotations.length - 1]; + if (lastAnnot?.data) { + lastAnnot.data.AS = 'Off'; + lastAnnot.data.V = 'Off'; + } + } catch (_) { } + // 8. Menge geliefert doc.font('Helvetica-Bold').fontSize(8).fillColor(textColor) .text(formatQuantity(amount) + ' Stk', colDeliv.deliv, y + 12, { width: colDeliv.delivW, align: 'right' });