Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
15d8a0bc3b fix(po): place stamp clear of the signature (no overlap)
Signatures/stamps aren't always transparent PNGs, so an opaque stamp would
cover the signature/name where it overlapped. Position the stamp to the right
of the centred signature with a 10px gap so it never overlays either.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 15:17:21 +05:30

View file

@ -478,11 +478,14 @@ export async function GET(request: NextRequest, { params }: Props) {
const sigExt = signatureBase64 ? scaleToBox(signatureSize ?? { width: 360, height: 96 }, 165, 44) : null;
const sigLeft = sigExt ? Math.round((SIG_BLOCK_PX - sigExt.width) / 2) : 0; // centred over the name
// Stamp / seal — drawn FIRST so it sits BEHIND the signature, tucked to its right.
// Stamp / seal — placed to the RIGHT of the signature with a gap, so it never
// overlays the signature or name (stamps/signatures aren't always transparent PNGs).
// Still drawn before the signature so it layers behind if they ever touch.
if (stampImg) {
const stampExt = scaleToBox(stampImg, 80, 66);
const STAMP_GAP = 10;
const stampLeft = sigExt
? Math.min(SIG_BLOCK_PX - stampExt.width, sigLeft + sigExt.width - Math.round(stampExt.width * 0.35))
? Math.min(SIG_BLOCK_PX - stampExt.width, sigLeft + sigExt.width + STAMP_GAP)
: SIG_BLOCK_PX - stampExt.width - 6;
const stampId = wb.addImage({
base64: stampImg.base64,