AddEmptySignatureField(PdfPage) Method (PdfPageDigitalSignatureHelper)
Adds the empty signature field to the PDF page.
Parameters
- page
- The page, where the empty signature field should be added.
Return Value
A new instance of
PdfInteractiveFormSignatureField class that represents added signature field.
Here is an example that shows how to add empty signature field to a PDF page:
Imports System.Drawing
Imports Vintasoft.Imaging.Pdf
''' <summary>
''' Adds empty signature field to a PDF page.
''' </summary>
Public Class PdfPageDigitalSignatureHelper_EmptySignatureField
''' <summary>
''' Adds an empty signature field to PDF document.
''' </summary>
''' <param name="inputFilename">The name of input PDF file.</param>
''' <param name="outputFilename">The name of output PDF file.</param>
Public Shared Sub AddEmptySignatureField(inputFilename As String, outputFilename As String)
' create a helper that alows to add digital signature to a PDF document
Dim digitalSignatureHelper As New PdfPageDigitalSignatureHelper(Nothing, New RectangleF(20, 20, 250, 100))
' set the appearance for signature field
digitalSignatureHelper.SignatureText = "Add your signature here"
digitalSignatureHelper.SignatureBackgoundColor = Color.Yellow
' open PDF document
Using document As New PdfDocument(inputFilename)
' add signature field to the first PDF page
digitalSignatureHelper.AddEmptySignatureField(document.Pages(0))
' save PDF document to the output file
document.SaveChanges("TestDocumentToSign-output.pdf")
End Using
End Sub
End Class
using System.Drawing;
using Vintasoft.Imaging.Pdf;
/// <summary>
/// Adds empty signature field to a PDF page.
/// </summary>
public class PdfPageDigitalSignatureHelper_EmptySignatureField
{
/// <summary>
/// Adds an empty signature field to PDF document.
/// </summary>
/// <param name="inputFilename">The name of input PDF file.</param>
/// <param name="outputFilename">The name of output PDF file.</param>
public static void AddEmptySignatureField(
string inputFilename,
string outputFilename)
{
// create a helper that alows to add digital signature to a PDF document
PdfPageDigitalSignatureHelper digitalSignatureHelper = new PdfPageDigitalSignatureHelper(null, new RectangleF(20, 20, 250, 100));
// set the appearance for signature field
digitalSignatureHelper.SignatureText = "Add your signature here";
digitalSignatureHelper.SignatureBackgoundColor = Color.Yellow;
// open PDF document
using (PdfDocument document = new PdfDocument(inputFilename))
{
// add signature field to the first PDF page
digitalSignatureHelper.AddEmptySignatureField(document.Pages[0]);
// save PDF document to the output file
document.SaveChanges("TestDocumentToSign-output.pdf");
}
}
}
Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5