Available for: UI for ASP.NET MVC | UI for ASP.NET AJAX | UI for Blazor | UI for WPF | UI for WinForms | UI for Silverlight | UI for Xamarin | UI for WinUI | UI for ASP.NET Core | UI for .NET MAUI

New to Telerik Document Processing? Download free 30-day trial

SignatureField class

This article describes the following topics:

Overview

This class corresponds to FormFieldType.Signature enum value and represents a placeholder which preserves the digital signature information.

To use the signing functionality in PdfProcessing for .NET Standard/.NET Core, you must add a reference to the System.Security.Cryptography.Pkcs NuGet package, version 6 or newer (This functionality is available since R1 2022 SP1).

Properties

SignatureField provides the following properties:

  • Signature: Gets or sets the Signature value.

    • Setting this property will sign the document during export. At this point, signing with multiple signatures is not supported.
    • To validate a signature, you can use the Validate() and TryValidate() methods. Note, that the validation requires that the stream, from which the document is imported, to be opened. The validation is performed for the current field, and against the state of the document in the moment of importing.

    More information on how you can digitally sign a document is available in the Digital Signature topic.

  • Widgets: The collection of Widget annotations, which represent the field on the PDF pages. The widgets can be added and removed from the collection using the collection's AddWidget() and Remove() methods respectively. As the widget collection implements the IEnumerable interface, the available widget instances can be iterated.

Example 1: Create a SignatureField and add it to a page

SignatureField signatureField = new SignatureField("SampleSignature"); 
signatureField.Signature = new Signature(certificate); // The Signature property fo SignatureField is not available in PdfProcessing for .NET Standard. 
 
SignatureWidget widget = signatureField.Widgets.AddWidget(); 
widget.Rect = new Rect(new Point(200, 600), new Size(100, 100)); 
widget.Border = new AnnotationBorder(5, AnnotationBorderStyle.Solid, null); 
 
// Create a Form object to define the appearance you would like for the signature field. 
Form form = new Form(); 
form.FormSource = new FormSource(); 
form.FormSource.Size = new Size(120, 120); 
 
FixedContentEditor formEditor = new FixedContentEditor(form.FormSource); 
formEditor.DrawCircle(new Point(50, 50), 20); 
formEditor.DrawText("Sample Signature"); 
 
// Add the FormSource object to the widget of the field. 
widget.Content.NormalContentSource = form.FormSource; 
widget.RecalculateContent(); 
 
RadFixedPage page = document.Pages.Last(); 
page.Annotations.Add(widget); 
document.AcroForm.FormFields.Add(signatureField); 

See Also

In this article