我正在使用 iTextSharp 对 PDF 进行签名。签名时,它会在文档上标记 4 个字段:签名者、签名时间、原因和地点。我的意思是在下方(或上方,这无关紧要)添加一个包含自定义信息的字段。
有什么想法吗?
这是我生成邮票的代码:
PdfStamper stp = PdfStamper.CreateSignature(reader, memoryOut, '\0');
PdfSignatureAppearance sap = stp.SignatureAppearance;
iTextSharp.text.Rectangle rectangle = new iTextSharp.text.Rectangle(100, 100, 500, 200);
sap.SetVisibleSignature(rectangle, stp.Reader.NumberOfPages, null);
sap.SignDate = DateTime.Now;
sap.SetCrypto(null, chain, null, null);
sap.Reason = ssReason;
sap.Contact = ssContact;
sap.Location = ssLocation;
sap.Acro6Layers = true;
//sap.SignatureGraphic = iTextSharp.text.Image.GetInstance(ssImageUrl);
//sap.SignatureGraphic.ScaleToFit(131, 45);
sap.Render = PdfSignatureAppearance.SignatureRender.Description;
最佳答案
几个选项:
修改来自
sap.getLayer(int)
的PdfTemplate
之一。调用
sap.setLayer2Text()
以包含您的额外信息。使用图形。您可以将
PdfTemplate
包装在Image
中,这样您就可以绘制任何您想要的东西。然后sap.Render = PdfSignatureAppearance.SignatureRender.GraphicAndDescription
破解源代码。
关于pdf - 使用 iTextSharp 自定义 PDFStamper,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4924330/