Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active September 16, 2022 13:55
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/f5a510f571794d280e711989e9ac030a to your computer and use it in GitHub Desktop.
Save bjoerntx/f5a510f571794d280e711989e9ac030a to your computer and use it in GitHub Desktop.
public static void SignDocument() {
using (ServerTextControl tx = new ServerTextControl()) {
tx.Create();
// add dummy text
tx.Text = "This is a signed document";
SaveSettings saveSettings = new SaveSettings();
// add digital signature to sign complete document
saveSettings.DigitalSignature = new DigitalSignature(
new System.Security.Cryptography.X509Certificates.X509Certificate2(
"textcontrolself.pfx", "123"), null);
// export to PDF
tx.Save("signed_documents.pdf", StreamType.AdobePDF, saveSettings);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment