Products Technologies Demo Docs Blog Support Company

How to Sign Signature Fields with Custom Signer Information and Time Stamps in ASP.NET Core C#

This article shows how to sign signature fields in a PDF document with custom signer information and timestamps using the TX Text Control .NET Server component in ASP.NET Core C#. The signature is created using a PFX certificate file.

How to Sign Signature Fields with Custom Signer Information and Time Stamps in ASP.NET Core C#

TX Text Control provides a powerful API to sign PDF documents with signature fields and digital signatures. This article shows how to sign a PDF document with a digital signature using the TX Text Control API and to set custom signer information.

Pre-Populated Signer Information

Signer information, such as the reason for signing and the signer's address, can be added at the design time of the document or template. This information is stored in the internal TX Text Control document format and can be used to pre-fill the signature fields.

The following screenshots show a signature field and the ribbon bar with the pre-populated information:

Signer Information and TX Text Control

When signing the document with a digital signature, the pre-populated information is used automatically.

Custom Signer Information

When signing a document with a digital signature, the signer information can be set programmatically using the SignerData property. This property is an instance of the SignerData class that provides the following properties:

Property Description
Reason Gets or sets the reason for signing the document.
Address Gets or sets the location of the signer.
ContactInfo Gets or sets the contact information of the signer.
Name Gets or sets the name of the signer.
Title Gets or sets the title of the signer.

The following code snippet shows how to set the signer information for a signature field:

using System.Security.Cryptography.X509Certificates;
using TXTextControl;

using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
        tx.Create();
        
        tx.Load("signature.tx", TXTextControl.StreamType.InternalUnicodeFormat);

        // create a certificate
        X509Certificate2 cert = new X509Certificate2("textcontrolself.pfx", "123");

        // create a list of digital signatures
        var digitalSignatures = new List<DigitalSignature>();

        foreach (SignatureField signatureField in tx.SignatureFields)
        {
                signatureField.SignerData = new SignerData(
                        "John Doe", 
                        "CEO", 
                        "11 Main Street, New York, NY 10001, USA",
                        "john@doe.com",
                        "Contract signature");

                // time stamp server
                var timeStampServer = "http://timestamp.digicert.com";

                // create a digital signature object
                DigitalSignature digitalSignature = new DigitalSignature(cert, timeStampServer, signatureField.Name);
                
                // add the digital signature to the list
                digitalSignatures.Add(digitalSignature);
        }

        // create save settings
        SaveSettings saveSettings = new SaveSettings()
        {
                CreatorApplication = "Your Application",
                SignatureFields = digitalSignatures.ToArray()
        };

        // save the document as PDF
        tx.Save("results_signed.pdf", StreamType.AdobePDFA, saveSettings);
}

Additionally, the time server is added to the digital signature. The timeServerURL parameter is set to the URL of the time server.

When the document is signed, the signature field is updated with the custom signer information:

Custom Signer Information

When the document is opened in Adobe Acrobat Reader, the custom signer information is displayed in the signature properties.

Conclusion

TX Text Control provides a powerful API to sign PDF documents with signature fields and digital signatures. The signer information can be pre-populated at the design time of the document or set programmatically using the SignerData property.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

ASP.NETASP.NET CoreCertificate

How to Sign PDF Documents with PFX Certificates in .NET C# on Linux

This article shows how to sign PDF documents with PFX certificates in .NET C# on Linux. The sample code uses the TX Text Control .NET Server component to create a PDF document and digitally sign…


ASP.NETBlazorASP.NET Core

E-Sign Comes to Blazor: Document Viewer 33.0.1 Released

We are excited to announce the release of TX Text Control Document Viewer 33.0.1 for Blazor! This version comes packed with one of the most requested features: Electronic signature support.


ASP.NETASP.NET CoreE-Sign

Adoption of Electronic vs. Paper Signatures in 2025

The move to electronic signatures has accelerated in recent years. However, many organizations still rely on paper signatures for core processes. This article examines the current state of…


ASP.NETASP.NET CoreDOCX

Sign Documents with a Self-Signed Digital ID From Adobe Acrobat Reader in…

This article shows how to create a self-signed digital ID using Adobe Acrobat Reader and how to use it to sign documents in .NET C#. The article also shows how to create a PDF document with a…


ASP.NETASP.NET CoreDocument Viewer

Transforming Financial Documents into Smart and Secure Forms in ASP.NET Core C#

This article shows how to transform financial documents into smart and secure forms in ASP.NET Core C#. All the necessary steps, from prepopulating the form fields to digital signatures, are…