TX Text Control is able to digitally sign Adobe PDF and PDF/A documents with X.509 certificates. The certificate can be assigned in the SaveSettings TX Text Control .NET for Windows Forms
TXTextControl Namespace
SaveSettings Class
The SaveSettings class provides properties for advanced settings and information during save operations.
class when saving document.

Signing With Certificate Files

TX Text Control can be used to sign PDF documents with a X509Certificate2 that is created from a PFX certificate file. This is typically used for automated processes where a PFX file can be stored on a server and no user interaction is required. The following code shows how to sign a PDF document with a PFX file:

public string ExportPDF(string document)
byte[] bPDF;
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
X509Certificate2 cert = new X509Certificate2
TXTextControl.SaveSettings saveSettings = new TXTextControl.SaveSettings()
DigitalSignature = new TXTextControl.DigitalSignature(cert, null)
// save the document as PDF
tx.Save(out bPDF, TXTextControl.BinaryStreamType.AdobePDFA, saveSettings);
// return as Base64 encoded string
return Convert.ToBase64String(bPDF);
view raw api.cs hosted with ❤ by GitHub

Signing With Smart Cards

By accepting a certificate provided by the Windows certificate store, you can sign documents with smart cards, PIV cards or USBs such as YubiKey.

The X509Certificate2UI class provides a UI to select and view X.509 certificates. In the following code, the SelectFromCollection method is used to open a dialog for selecting the certificate. All registered certificates including smart cards are listed in the dialog box.

// get and open certificate store for current user
System.Security.Cryptography.X509Certificates.X509Store store =
new System.Security.Cryptography.X509Certificates.X509Store(
// retrieve the certificate using the integrated Windows UI
System.Security.Cryptography.X509Certificates.X509Certificate2Collection certificates =
"Choose your certificate",
"Please select a certificate that is used by Text Control to sign your PDF document.",
// apply the first selected certificate
TXTextControl.SaveSettings saveSettings = new TXTextControl.SaveSettings() {
DigitalSignature = new TXTextControl.DigitalSignature(certificates[0], null)
// export the PDF
textControl1.Save("test.pdf", TXTextControl.StreamType.AdobePDFA, saveSettings);
view raw test.cs hosted with ❤ by GitHub


After the document has been created and is opened in Acrobat Reader, the valid signatures are shown in the Signatures sidebar:

PDF Acrobat Reader