Skip to content

Commit b099bf4

Browse files
committed
Extend SignatureFieldAppearance model element API
DEVSIX-7796
1 parent 984aa6d commit b099bf4

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed
Binary file not shown.

itext/itext.samples/itext/samples/sandbox/signatures/SignatureExample.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ protected void SignDocumentSignature(string filePath, ElectronicSignatureInfoDTO
5959
// the name that doesn't exist in the document or don't specify it at all) then
6060
// the signature is invisible by default.
6161
SignatureFieldAppearance appearance = new SignatureFieldAppearance(pdfSigner.GetFieldName())
62-
.SetRenderingMode(SignatureFieldAppearance.RenderingMode.GRAPHIC)
63-
.SetReason("")
64-
.SetLocationCaption("")
65-
.SetSignatureGraphic(clientSignatureImage);
62+
.SetContent(clientSignatureImage);
6663
pdfSigner.SetPageNumber(signatureInfo.PageNumber)
6764
.SetPageRect(new Rectangle(signatureInfo.Left, signatureInfo.Bottom,
6865
25, 25))

itext/itext.samples/itext/samples/sandbox/typography/latin/LatinSignature.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using iText.Bouncycastle.Crypto;
66
using iText.Commons.Bouncycastle.Cert;
77
using iText.Commons.Utils;
8+
using iText.Forms.Fields.Properties;
89
using iText.Forms.Form.Element;
910
using Org.BouncyCastle.Crypto;
1011
using Org.BouncyCastle.X509;
@@ -66,10 +67,13 @@ public virtual void CreatePDF(String dest)
6667
signer.SetFieldName("Field1");
6768

6869
// Get Signature Appearance and set some of its properties
70+
String signerName = CertificateInfo.GetSubjectFields(new X509CertificateBC(signChain[0])).GetField("CN");
6971
SignatureFieldAppearance appearance = new SignatureFieldAppearance(signer.GetFieldName())
70-
.SetReason(line1)
71-
.SetLocation(line2)
72-
.SetReasonCaption(line3)
72+
.SetContent(new SignedAppearanceText()
73+
.SetSignedBy(signerName)
74+
.SetReasonLine(line3 + line1)
75+
.SetLocationLine("Location: " + line2)
76+
.SetSignDate(signer.GetSignDate()))
7377
.SetFont(font);
7478
signer.SetPageRect(rect)
7579
.SetSignatureAppearance(appearance);

0 commit comments

Comments
 (0)