AddVisibleDigitalSignatureWithImageAppearance(X509Certificate2,String,String,String,RectangleF) Method (PdfPage)
Adds visible digital signature with image appearance to the specified PDF page.
Here is an example that shows how to sign a PDF document using visisble signature with image appearance:
Imports System.Drawing
Imports System.Security.Cryptography.X509Certificates
Imports Vintasoft.Imaging.Pdf
Imports Vintasoft.Imaging.Pdf.Tree
''' <summary>
''' Adds digital signature with image appearance to a PDF page.
''' </summary>
Public Class PdfPage_AddVisibleDigitalSignatureWithImageAppearanceExample
Public Shared Sub Run()
' get the X509 certificate from .pfx-file
Using certificate As New X509Certificate2("TestCertificate.pfx", "test")
' open PDF document
Using pdfDocument As New PdfDocument("TestDocumentToSign.pdf")
' get the first PDF page
Dim pdfPage As PdfPage = pdfDocument.Pages(0)
' add visible digital signature with image appearance to the PDF page
pdfPage.AddVisibleDigitalSignatureWithImageAppearance(certificate, "Signature", "Approve document", "SignatureImage.svg", New RectangleF(20, 20, 250, 100), False)
' sign PDF document and save PDF document to the output file
pdfDocument.SaveChanges("TestDocumentToSign-signed-image.pdf")
End Using
End Using
End Sub
End Class
using System.Drawing;
using System.Security.Cryptography.X509Certificates;
using Vintasoft.Imaging.Pdf;
using Vintasoft.Imaging.Pdf.Tree;
/// <summary>
/// Adds digital signature with image appearance to a PDF page.
/// </summary>
public class PdfPage_AddVisibleDigitalSignatureWithImageAppearanceExample
{
public static void Run()
{
// get the X509 certificate from .pfx-file
using (X509Certificate2 certificate = new X509Certificate2(@"TestCertificate.pfx", "test"))
// open PDF document
using (PdfDocument pdfDocument = new PdfDocument(@"TestDocumentToSign.pdf"))
{
// get the first PDF page
PdfPage pdfPage = pdfDocument.Pages[0];
// add visible digital signature with image appearance to the PDF page
pdfPage.AddVisibleDigitalSignatureWithImageAppearance(
certificate, "Signature", "Approve document", "SignatureImage.svg",
new RectangleF(20, 20, 250, 100), false);
// sign PDF document and save PDF document to the output file
pdfDocument.SaveChanges(@"TestDocumentToSign-signed-image.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