Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created January 6, 2023 13:18
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/dde7740ed6ae5adc81eca1bf3ee1cf4e to your computer and use it in GitHub Desktop.
Save bjoerntx/dde7740ed6ae5adc81eca1bf3ee1cf4e to your computer and use it in GitHub Desktop.
using (TXTextControl.ServerTextControl tx = new ServerTextControl()) {
tx.Create();
tx.Load("test.docx", TXTextControl.StreamType.WordprocessingML);
List<TXTextControl.DigitalSignature> digitalSignatures = new List<DigitalSignature>();
foreach (SignatureField field in tx.SignatureFields) {
digitalSignatures.Add(new DigitalSignature(
new System.Security.Cryptography.X509Certificates.X509Certificate2(
"textcontrolself.pfx", "123"), null, field.Name));
}
SaveSettings saveSettings = new SaveSettings() {
SignatureFields = digitalSignatures.ToArray()
};
tx.Save("results.pdf", TXTextControl.StreamType.AdobePDF, saveSettings);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment