diff --git a/lib/documents.js b/lib/documents.js index e503ab1..7f2c62c 100644 --- a/lib/documents.js +++ b/lib/documents.js @@ -1073,7 +1073,12 @@ function composeLetter(doc, S, dry, cur, { letter, header, job, anlagen, signatu // the reserved bottom margin so it never collides with the body. --- if (!dry) { const parts = []; - if (header.adresse) parts.push(String(header.adresse).replace(/\s*,\s*/g, ', ')); + // Flatten a possibly multi-line address (newlines and/or commas) to one + // line — doc.text breaks on \n, which would stack the street above the city. + if (header.adresse) { + const adr = String(header.adresse).split(/[\n,]/).map((s) => s.trim()).filter(Boolean).join(', '); + if (adr) parts.push(adr); + } if (header.telefon) parts.push(header.telefon); if (header.email) parts.push(header.email); if (parts.length) {