Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created December 19, 2023 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/5e5d5d80c3ab9d51dd49e70ec6ef4404 to your computer and use it in GitHub Desktop.
Save bjoerntx/5e5d5d80c3ab9d51dd49e70ec6ef4404 to your computer and use it in GitHub Desktop.
var signerData = new SignerData(
"John Doe", "Signer", "676 Sign Street", "john@signer.com", "I approve this document");
var signatureStyle = new SignatureStyle {
SvgImage = System.IO.File.ReadAllText("signature.svg"),
DetailsFont = new Font("Arial", 13)};
// Add a signature box to the document
var fieldName = SignatureBoxManager.AddSignatureBox(
textControl1,
new Size(8000, 2000),
1,
SignatureLocation.BottomLeft,
signerData,
signatureStyle
);
// Create a digital signature using a certificate
var certificate = new X509Certificate2("textcontrolself.pfx", "123");
var signatureFields = new List<DigitalSignature> { new DigitalSignature(certificate, null, fieldName) };
var saveSettings = new TXTextControl.SaveSettings
{
SignatureFields = signatureFields.ToArray()
};
// Save the document as PDF/A
textControl1.Save("signed.pdf", TXTextControl.StreamType.AdobePDFA, saveSettings);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment