diff --git a/packages/core-service/src/core/expert-profile/profile-export.service.ts b/packages/core-service/src/core/expert-profile/profile-export.service.ts index 181b01c..88ce1ab 100644 --- a/packages/core-service/src/core/expert-profile/profile-export.service.ts +++ b/packages/core-service/src/core/expert-profile/profile-export.service.ts @@ -568,10 +568,24 @@ export class ProfileExportService { yRight += 12; // Timeline-Linie: nur zeichnen wenn kein Seitenumbruch im Eintrag - // UND der nächste Eintrag noch auf dieser Seite passt (kein hängender Strich) - if (i < profile.projects.length - 1 && !pageBreakOccurred && yRight + 40 <= pageBottom) { - doc.moveTo(timelineX, entryStartY + 8).lineTo(timelineX, yRight - 4) - .strokeColor(accentColor).lineWidth(1).stroke(); + // UND der nächste Eintrag noch auf dieser Seite passt (exakte Header-Höhe prüfen) + if (i < profile.projects.length - 1 && !pageBreakOccurred) { + const nextProj = profile.projects[i + 1]; + const nextRoleText = this.sanitizePdfText(nextProj.role); + const nextCompanyLine = nextProj.company + ? this.sanitizePdfText([nextProj.company, nextProj.industry].filter(Boolean).join(' \u00b7 ')) + : ''; + doc.font('Helvetica-Bold').fontSize(10); + const nextRoleH = doc.heightOfString(nextRoleText, { width: contentWidth }); + doc.fontSize(9); + const nextCompanyH = nextCompanyLine + ? doc.heightOfString(nextCompanyLine, { width: contentWidth }) + 2 + : 0; + const nextHeaderH = 14 + nextRoleH + 2 + nextCompanyH + 8; + if (yRight + nextHeaderH <= pageBottom) { + doc.moveTo(timelineX, entryStartY + 8).lineTo(timelineX, yRight - 4) + .strokeColor(accentColor).lineWidth(1).stroke(); + } } } }