fix(pdf): drop product title down 10pt on page 2 to eliminate clipping and center grid values

This commit is contained in:
2026-03-03 13:29:00 +01:00
parent 11723bf184
commit 4e0d8a0f3a
51 changed files with 8 additions and 7 deletions

View File

@@ -1164,7 +1164,7 @@ function drawKeyValueTable(args: {
const labelSize = 7.25;
const valueSize = 8.75;
const labelYOff = 12;
const valueYOff = 28;
const valueYOff = 26;
const rows = Math.ceil(items.length / cols);
const boxH = headerPadY + titleH + rows * cellH + headerPadY;
@@ -3386,8 +3386,9 @@ function drawHeader(ctx: SectionDrawContext, yStart: number): number {
color: colors.lightGray,
});
// Content start: keep breathing room below the header, but use page height efficiently.
return dividerY - 22;
// Content start: keep breathing room below the header
// (Increased gap to prevent text on page 2 from looking 'stuck' to the header)
return dividerY - 32;
}
function drawCrossSectionChipsRow(args: {
@@ -4073,17 +4074,17 @@ async function generatePDF(product: ProductData, locale: 'en' | 'de'): Promise<B
const name = stripHtml(product.name);
const maxW = ctx.contentWidth;
const line = wrapText(name, fontBold, 12, maxW).slice(0, 1)[0] || name;
// Render name a bit lower inside the header space
const headerTopPadding = 24;
p.drawText(line, {
x: margin,
y: height - headerTopPadding - 32,
y: yStart,
size: 12,
font: fontBold,
color: navy,
maxWidth: maxW,
});
return yStart - 18;
// Pushing the table content even further down below the title
return yStart - 28;
};
// Real multi-page support.