【发布时间】:2018-07-31 18:55:53
【问题描述】:
我有一个使用 iText 5.5.9 将签名字段添加到 PDF 单元格的方法。
private static void addSignatureFieldToCell(String fieldname, PdfPCell pdfPCell, PdfWriter pdfWriter) {
PdfFormField digitalSignatureField = PdfFormField.createSignature(pdfWriter);
// If the PDF is not signed we don't show anything
digitalSignatureField.setWidget(new Rectangle(0, 0, 0, 0), PdfAnnotation.HIGHLIGHT_NONE);
digitalSignatureField.setFieldName(fieldname);
// With this flag the field is shown on Acrobat
digitalSignatureField.setFieldFlags(PdfAnnotation.FLAGS_PRINT);
// This allows to show the signature on the signatures panel at the left
digitalSignatureField.setPage();
pdfWriter.addAnnotation(digitalSignatureField);
// This is the event attached to the cell that tells the writer to fill the field with the signature data
FieldPositioningEvents fieldPositioningEvents = new FieldPositioningEvents(pdfWriter, digitalSignatureField);
pdfPCell.setCellEvent(fieldPositioningEvents);
}
这工作正常。经过一些步骤,数字签名的信息在 PDF 上。我打开 Acrobat Reader,我可以看到数字签名的 PDF 等等。
问题是当我要从 Acrobat 打印 PDF 时。预览中没有显示签名的信息,当然打印文件时也没有显示,所以这个框是空白的。
我是否缺少 PdfFormField 上的一些配置?我需要什么才能允许打印签名?
【问题讨论】:
-
请分享样本结果 PDF 以供分析。
-
刚刚在问题末尾添加了链接
标签: java pdf printing itext digital-signature