fix(planting): remove signature button field before flatten to avoid gray background

The signature button field has a gray background that covers the drawn
signature image when the form is flattened. Now we remove the signature
field after drawing the signature image to prevent this.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-03 23:45:44 -08:00
parent 439dcb95ac
commit ef80a2f23b
1 changed files with 10 additions and 0 deletions

View File

@ -442,6 +442,16 @@ export class PdfGeneratorService {
});
this.logger.log(`Signature drawn at (${signatureX}, ${signatureY}), size: ${scaledWidth}x${scaledHeight}`);
// 移除签名按钮字段,避免扁平化时产生灰色背景
try {
const form = pdfDoc.getForm();
const signatureButton = form.getButton(FORM_FIELDS.SIGNATURE);
form.removeField(signatureButton);
this.logger.log('Signature button field removed');
} catch {
// 忽略移除失败
}
}
// 6. 最后统一扁平化所有表单字段