Digitally Signing Adobe PDF Documents
Using TX Text Control, there are two ways of signing PDF documents: The whole document and individual signature fields. This article shows how to implement both ways in a .NET 6 command line application.

The Adobe PDF document format is used to share all kinds of information including data with a legal value such as in contracts or invoices. To ensure that a document has not been altered by a third-party and to verify that the author is the expected person, documents can be digitally signed.
A digital signature use the concept of hashing - a mathematical function that converts a block of data into a fixed-size string. The result of this function is always identical for this block of data, if the data block has not been altered.
This hash function is used on almost all elements of a document and is then stored inside the document.
When signing Adobe PDF documents, there are two different approaches:
- Sign the whole document with a digital certificate
- Sign individual signature fields with a digital certificate(s)
Technically, a visual representation of the signature compared to wet ink is not required to sign a document. But in many cases, an electronic signature that is captured using the TX Text Control Document Viewer, can be signed with a digital certificate.
This article shows how to implement both ways in a .NET 6 command line application.
Signing the Document
The first method shows how to digitally sign the complete document with one certificate. The signatures can be created with PFX, DER Cer or Base64 CER certificate files. Additionally, certificates can be loaded from raw data or selected from the local certificate store. The digital signature and the signed PDF document are cryptographically bound and secured which guarantees that the document has not been tampered.
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);
}
}
A Digital
When opening the created PDF document in Acrobat Reader, the digital signature is recognized and shows an invisible signature field.

Signing Signature Fields
In the second method, a digital certificate is applied to the signed electronic signature representation using the Signature
In the following code snipped, a signature field is added to a new document and an SVG image is added as the visual signature representation. The created digital signature is associated with the signature field and then provided by the SaveSettings to export the document as an Adobe PDF document.
public static void SignFields() {
using (ServerTextControl tx = new ServerTextControl()) {
tx.Create();
// create a signature field
SignatureField signatureField = new SignatureField(
new System.Drawing.Size(2000, 2000), "txsign", 10);
// set image representation
signatureField.Image = new SignatureImage("signature.svg", 0);
// insert the field
tx.SignatureFields.Add(signatureField, -1);
// create a digital signature (for each field, if required)
DigitalSignature digitalSignature = new DigitalSignature(
new System.Security.Cryptography.X509Certificates.X509Certificate2(
"textcontrolself.pfx", "123"), null, "txsign");
// apply the signatures to the SaveSettings
SaveSettings saveSettings = new SaveSettings() {
SignatureFields = new DigitalSignature[] { digitalSignature }
};
// export to PDF
tx.Save("signed_fields.pdf", StreamType.AdobePDF, saveSettings);
}
}
When loading this document into Acrobat Reader, the signature field is shown as a visual representation in the document. If you click on that field, a dialog confirms the validation status. Additionally, the signature field name is shown in the sidebar.

When specifying additional properties to the signature field, those values are displayed in the signature details in Acrobat Reader:
// create a signature field
SignatureField signatureField = new SignatureField(
new System.Drawing.Size(2000, 2000), "txsign", 10) {
Image = new SignatureImage("signature.svg", 0),
SignerData = new SignerData(
"Tim Typer",
"Developer",
"5652 Text Control Dr",
"tim@textcontrol.com",
"Contract signature")
};

![]()
Download and Fork This Sample on GitHub
We proudly host our sample code on github.com/TextControl.
Please fork and contribute.
Requirements for this sample
- TX Text Control .NET Server 31.0
- Visual Studio 2022
ASP.NET
Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.
- Angular
- Blazor
- React
- JavaScript
- ASP.NET MVC, ASP.NET Core, and WebForms
Related Posts
ASP.NETASP.NET CoreDigital Signing
Adding Digital Signatures to PDF Documents in C#
Using TX Text Control, adding digital and electronic signatures to documents is an easy task. This article shows how to sign the complete document with a digital certificate and how to sign…
Automating PDF/UA Accessibility with AI: Describing DOCX Documents Using TX…
This article shows how to use TX Text Control together with the OpenAI API to automatically add descriptive texts (alt text and labels) to images, links, and tables in a DOCX. The resulting…
Converting Office Open XML (DOCX) to PDF in Java
Learn how to convert Office Open XML (DOCX) documents to PDF in Java using the powerful ServerTextControl library. This guide provides step-by-step instructions and code examples to help you…
Extending DS Server with Custom Digital Signature APIs
In this article, we will explore how to extend the functionality of DS Server by integrating custom digital signature APIs. We will cover the necessary steps to create a plugin that allows DS…
Why PDF/UA and PDF/A-3a Matter: Accessibility, Archiving, and Legal Compliance
It is more important than ever to ensure that documents are accessible, archivable, and legally compliant. PDF/UA and PDF/A-3a are two effective standards for addressing these needs. This article…
