0

一天中的大部分时间我都在研究这个问题。我有一个使用 iTextSharp 签署 PDF 文档的现有应用程序。数字签名存在并且文本表示显示在 PDF 的签名字段中,但签名的图像不显示。

以下是有问题的代码。感谢您提供的任何帮助/建议。

if (signatureBitmap != null)
{
    if (reader == null) reader = new PdfReader(PDFByteArray);

    pdfStamper = PdfStamper.CreateSignature(reader, outputStream, PDFVersion, null, true);

    PdfSignatureAppearance signatureAppearance = pdfStamper.SignatureAppearance;

    //Add digital certificate to field
    signatureAppearance.SetCrypto(Key, Certificate, null, PdfSignatureAppearance.SELF_SIGNED);
    signatureAppearance.Reason = Reason;
    signatureAppearance.Location = Location;

    signatureAppearance.Render = PdfSignatureAppearance.SignatureRender.GraphicAndDescription;

    if (signatureBitmap != null)
    {
        iTextSharp.text.Image signatureFieldImage = iTextSharp.text.Image.GetInstance(signatureBitmap, System.Drawing.Imaging.ImageFormat.Bmp);
        signatureAppearance.SignatureGraphic = signatureFieldImage;
    }

    signatureAppearance.Acro6Layers = acroLayer;
    signatureAppearance.SetVisibleSignature(acrobatSignatureFieldName);
    pdfStamper.Close();
    reader.Close();
    reader = null;

}
4

1 回答 1

0

you need the position about your signature, try with this:

Rectangle rSignature= new Rectangle(100,100);
signatureAppearance.setVisibleSignature(rSignature, 1, "a name");
于 2013-06-13T19:24:20.997 回答