|
6 | 6 | using iText.Bouncycastle.Crypto; |
7 | 7 | using iText.Commons.Bouncycastle.Cert; |
8 | 8 | using iText.Commons.Bouncycastle.Crypto; |
| 9 | +using iText.Forms.Form.Element; |
9 | 10 | using iText.IO.Image; |
10 | 11 | using iText.Kernel.Geom; |
11 | 12 | using iText.Kernel.Pdf; |
@@ -57,14 +58,15 @@ protected void SignDocumentSignature(string filePath, ElectronicSignatureInfoDTO |
57 | 58 | // If you create new signature field (or use SetFieldName(System.String) with |
58 | 59 | // the name that doesn't exist in the document or don't specify it at all) then |
59 | 60 | // the signature is invisible by default. |
60 | | - PdfSignatureAppearance signatureAppearance = pdfSigner.GetSignatureAppearance(); |
61 | | - signatureAppearance.SetRenderingMode(PdfSignatureAppearance.RenderingMode.GRAPHIC); |
62 | | - signatureAppearance.SetReason(""); |
63 | | - signatureAppearance.SetLocationCaption(""); |
64 | | - signatureAppearance.SetSignatureGraphic(clientSignatureImage); |
65 | | - signatureAppearance.SetPageNumber(signatureInfo.PageNumber); |
66 | | - signatureAppearance.SetPageRect(new Rectangle(signatureInfo.Left, signatureInfo.Bottom, |
67 | | - 25, 25)); |
| 61 | + SignatureFieldAppearance appearance = new SignatureFieldAppearance(pdfSigner.GetFieldName()) |
| 62 | + .SetRenderingMode(SignatureFieldAppearance.RenderingMode.GRAPHIC) |
| 63 | + .SetReason("") |
| 64 | + .SetLocationCaption("") |
| 65 | + .SetSignatureGraphic(clientSignatureImage); |
| 66 | + pdfSigner.SetPageNumber(signatureInfo.PageNumber) |
| 67 | + .SetPageRect(new Rectangle(signatureInfo.Left, signatureInfo.Bottom, |
| 68 | + 25, 25)) |
| 69 | + .SetSignatureAppearance(appearance); |
68 | 70 |
|
69 | 71 | char[] password = "testpass".ToCharArray(); |
70 | 72 | IExternalSignature pks = GetPrivateKeySignature(CERT_PATH, password); |
|
0 commit comments