Adding visible digital signatures to a PDF document
Use visible digital signatures to combine visual signoff with cryptographic integrity.
Common use cases include:
- Contract signing workflows
- Document approval systems
- Authenticated signoff pipelines
- Branded signature appearances
Unlike invisible signatures, visible signatures render a signature area on the page using text or images.
Download sampleHow Nutrient helps
Nutrient .NET SDK handles signature field operations, appearance rendering, and cryptographic signing.
The SDK handles:
- Signature field dictionaries and appearance streams
- PKCS#12 certificate loading and key extraction
- Appearance customization and font rendering
- Byte range calculations and signing internals
Complete implementation
This example adds a visible signature field and signs it with different appearance options:
using Nutrient;Creating a signature field
Create a signature field at the target location before signing.
In this sample:
- The document opens in a using statement(opens in a new tab).
- The field name is
ApprovalSignature. - The position is
(100, 700). - The size is
200 × 50.
The field acts as the visible placeholder for the signed appearance:
using (Document document = Document.Open("input.pdf"))using (PdfEditor editor = PdfEditor.Edit(document)){ PdfPage page = editor.PageCollection.First ?? throw new InvalidOperationException("The document has no pages.");
editor.FormFieldCollection.AddSignatureField( "ApprovalSignature", page, 100.0f, // x 700.0f, // y 200.0f, // width 50.0f // height );
editor.SaveAs("output_document_with_field.pdf");}Signing with auto-generated appearance
Sign the field with metadata-driven text.
In this sample:
DigitalSignatureOptionssets certificate and signer metadata.Document.Open("output_document_with_field.pdf")opens the PDF before signing.- Setting
UseAutoGeneratedTexttotrueuses signer metadata in the appearance. - Setting
ShowValidationMarktotrueadds a validation indicator. SignField(document, outputPath, fieldName, options, appearance)signs"ApprovalSignature".
using (Signature signer = new Signature())using (Document document = Document.Open("output_document_with_field.pdf")){ using DigitalSignatureOptions options = new DigitalSignatureOptions(); options.CertificatePath = "certificate.pfx"; options.CertificatePassword = "Nutrient answers all your document needs"; options.SignerName = "John Doe"; options.Reason = "Final Approval"; options.Location = "New York";
using SignatureAppearance appearance = new SignatureAppearance(); appearance.UseAutoGeneratedText = true; appearance.ShowValidationMark = true;
signer.SignField( document, "output_signed_visible.pdf", "ApprovalSignature", options, appearance );}Signing with a custom image
Use an image-based appearance for handwritten signatures or logos.
In this sample:
Document.Open("output_document_with_field.pdf")opens the PDF before signing.ImagePathpoints to the signature image file.- The image renders inside field bounds.
- Setting
ShowValidationMarktotruekeeps the validation indicator visible. SignField(document, outputPath, fieldName, options, appearance)applies the digital signature.
using (Signature signer = new Signature())using (Document document = Document.Open("output_document_with_field.pdf")){ using DigitalSignatureOptions options = new DigitalSignatureOptions(); options.CertificatePath = "certificate.pfx"; options.CertificatePassword = "Nutrient answers all your document needs"; options.SignerName = "Jane Smith"; options.Reason = "Review Complete";
using SignatureAppearance appearance = new SignatureAppearance(); appearance.ImagePath = "input_signature.jpg"; appearance.ShowValidationMark = true;
signer.SignField( document, "output_signed_with_image.pdf", "ApprovalSignature", options, appearance );}Signing with custom text
Use custom text when you need workflow-specific signature content.
In this sample:
Document.Open("output_document_with_field.pdf")opens the PDF before signing.- Setting
UseAutoGeneratedTexttofalsedisables metadata-generated text. Textdefines the visible signature content.\ncreates multiline output.SignField(document, outputPath, fieldName, options, appearance)applies the digital signature.
using (Signature signer = new Signature())using (Document document = Document.Open("output_document_with_field.pdf")){ using DigitalSignatureOptions options = new DigitalSignatureOptions(); options.CertificatePath = "certificate.pfx"; options.CertificatePassword = "Nutrient answers all your document needs"; options.SignerName = "Manager";
using SignatureAppearance appearance = new SignatureAppearance(); appearance.UseAutoGeneratedText = false; appearance.Text = "Approved by Management\nDate: 2024-01-15";
signer.SignField( document, "output_signed_custom_text.pdf", "ApprovalSignature", options, appearance );}Customizing text appearance
Customize typography to match document or brand requirements.
In this sample:
Document.Open("output_document_with_field.pdf")opens the PDF before signing.FontNamesets the typeface.FontSizesets text size.TextColorsets ARGB color values.SignField(document, outputPath, fieldName, options, appearance)applies the digital signature.
using (Signature signer = new Signature())using (Document document = Document.Open("output_document_with_field.pdf")){ using DigitalSignatureOptions options = new DigitalSignatureOptions(); options.CertificatePath = "certificate.pfx"; options.CertificatePassword = "Nutrient answers all your document needs"; options.SignerName = "Executive";
using SignatureAppearance appearance = new SignatureAppearance(); appearance.UseAutoGeneratedText = false; appearance.Text = "Approved by Executive Board"; appearance.FontName = "Times New Roman"; appearance.FontSize = 14.0f; appearance.TextColor = Color.FromArgb(255, 0, 0, 128); // Navy blue
signer.SignField( document, "output_signed_styled_text.pdf", "ApprovalSignature", options, appearance ); Console.WriteLine("Successfully signed all documents");}Conclusion
Use this workflow to add visible digital signatures:
- Open the document with
usingstatements for automatic resource cleanup. - Create an editor and access the page collection.
- Add a signature field at specified coordinates with defined dimensions (e.g. 100, 700, 200×50 points).
- The signature field creates a rectangular placeholder for the signature appearance.
- Sign the field using
Signaturewith certificate credentials (PKCS#12 format). - Configure signing metadata, including signer name, reason, and location.
- Create the signature appearance with auto-generated text (set
UseAutoGeneratedTexttotrue) to display metadata. - Add validation marks (set
ShowValidationMarktotrue) to indicate signature validity. - Use custom images via
ImagePathfor handwritten signatures or company logos. - Use custom text by setting
UseAutoGeneratedTexttofalse, with multiline formatting for workflow-specific approvals. - Customize typography with
FontName,FontSize, andTextColorusing ARGB values. - Save the signed document with visible signature appearance and cryptographic integrity.
For related signing workflows, refer to the .NET SDK guides.