Summary
drawCertInfo starts text at opts.y + opts.height - 20 and decrements by lineHeight = 14 per line with no check that text stays within the signature box. For small signature heights, text overflows below opts.y, placing content outside the designated signature rectangle.
Root Cause
appearance.ts:94:
let textY = opts.y + opts.height - 20;
And subsequent lines:
textY -= lineHeight; // 14px per line
// ... no lower-bound guard
For height: 40, the box spans [opts.y, opts.y + 40]. Starting at opts.y + 20, then decrementing 14px × 4 lines = 56px total drop, text lands at opts.y - 36 — 36 points below the box floor.
Affected Files
libraries/e-signature/src/appearance.ts:94 — textY initialization
libraries/e-signature/src/appearance.ts:104-170 — no bounds check in the text-drawing loop
Evidence
For height: 60, up to 4 text lines are drawn:
Line 1: y = 60 - 20 = 40 above box origin → inside ✓
Line 2: y = 40 - 14 = 26 above box origin → inside ✓
Line 3: y = 26 - 14 = 12 above box origin → inside ✓
Line 4: y = 12 - 14 = -2 above box origin → OUTSIDE ✗
Suggested Fix
Summary
drawCertInfostarts text atopts.y + opts.height - 20and decrements bylineHeight = 14per line with no check that text stays within the signature box. For small signature heights, text overflows belowopts.y, placing content outside the designated signature rectangle.Root Cause
appearance.ts:94:And subsequent lines:
For
height: 40, the box spans[opts.y, opts.y + 40]. Starting atopts.y + 20, then decrementing 14px × 4 lines = 56px total drop, text lands atopts.y - 36— 36 points below the box floor.Affected Files
libraries/e-signature/src/appearance.ts:94—textYinitializationlibraries/e-signature/src/appearance.ts:104-170— no bounds check in the text-drawing loopEvidence
For
height: 60, up to 4 text lines are drawn:Suggested Fix
page.drawTextcall:fontSizeandlineHeightbased on available box heightheightto schema (e.g.,z.number().min(60)) to ensure the box can accommodate content