尝试在启动PdfSignatureHandler之前打印文本它对我来说很好。
private static void SignExisting() { double height = 40; double width = 200; double x = 0; double y = 0; PdfDocument pdfDocument = PdfReader.Open(path); PdfPage pp = pdfDocument.Pages[0]; var cert = GetCertificate(); string signtext = "Digitaly Signed by " + cert.GetNameInfo(X509NameType.SimpleName, false); XGraphics gfx = XGraphics.FromPdfPage(pp); XFont font = new XFont("Arial", 10, XFontStyle.Regular); gfx.DrawString(signtext, font, XBrushes.Black, new XRect(x, pp.Height - y, pp.Width, pp.Height), XStringFormats.TopLeft); gfx.DrawString("Date: " + DateTime.Now.ToString(), font, XBrushes.Black, new XRect(x, pp.Height - y, pp.Width, pp.Height), XStringFormats.TopLeft); PdfSignatureOptions options = new PdfSignatureOptions { ContactInfo = cert.GetNameInfo(X509NameType.SimpleName, false), Location = cert.Subject, Reason = "", Rectangle = new XRect(x, y, width, height), AppearanceHandler = new SignAppearenceHandler() }; PdfSignatureHandler pdfSignatureHandler = new PdfSignatureHandler(cert, null, options); pdfSignatureHandler.AttachToDocument(pdfDocument); Stream stream = new MemoryStream(); pdfDocument.Save(stream); }