SignatureText Свойство (PdfPageDigitalSignatureHelper)
В этом разделе
Возвращает или задает текст, который должен быть нанесен на подпись.
Синтаксис
'Declaration
Public Property SignatureText As System.String
public System.String SignatureText { get; set; }
public: __property System.String get_SignatureText();
public: __property void set_SignatureText(
System.String
);
public:
property System.String SignatureText {
System.String get();
void set(System.String );
}
Пример
Вот пример, который показывает, как подписать PDF документ с помощью цифровой подписи в текстовом виде:
Imports System.Drawing
Imports System.Security.Cryptography.X509Certificates
Imports Vintasoft.Imaging.Pdf
''' <summary>
''' Adds digital signature with text appearance to a PDF page.
''' </summary>
Public Class PdfPageDigitalSignatureHelper_TextAppearance
Public Shared Sub Run()
' get the X509 certificate from .pfx-file
Using certificate As New X509Certificate2("TestCertificate.pfx", "test")
' create a helper that alows to add digital signature to a PDF document
Dim digitalSignatureHelper As New PdfPageDigitalSignatureHelper(certificate, New RectangleF(20, 20, 250, 100))
' set the reason for signing
digitalSignatureHelper.SigningReason = "Approve document"
' set the signature appearance text
digitalSignatureHelper.SignatureText = String.Format("Digitally signed by" & vbLf & "{0}", digitalSignatureHelper.SignerName)
' add digital signature to the first PDF page, sign PDF document and save PDF document to the output file
digitalSignatureHelper.SignDocument("TestDocumentToSign.pdf", "TestDocumentToSign-signed.pdf", 0)
End Using
End Sub
End Class
using System.Drawing;
using System.Security.Cryptography.X509Certificates;
using Vintasoft.Imaging.Pdf;
/// <summary>
/// Adds digital signature with text appearance to a PDF page.
/// </summary>
public class PdfPageDigitalSignatureHelper_TextAppearance
{
public static void Run()
{
// get the X509 certificate from .pfx-file
using (X509Certificate2 certificate = new X509Certificate2("TestCertificate.pfx", "test"))
{
// create a helper that alows to add digital signature to a PDF document
PdfPageDigitalSignatureHelper digitalSignatureHelper =
new PdfPageDigitalSignatureHelper(certificate, new RectangleF(20, 20, 250, 100));
// set the reason for signing
digitalSignatureHelper.SigningReason = "Approve document";
// set the signature appearance text
digitalSignatureHelper.SignatureText = string.Format("Digitally signed by\n{0}", digitalSignatureHelper.SignerName);
// add digital signature to the first PDF page, sign PDF document and save PDF document to the output file
digitalSignatureHelper.SignDocument("TestDocumentToSign.pdf", "TestDocumentToSign-signed.pdf", 0);
}
}
}
Требования
Целевые платформы: .NET 11; .NET 10; .NET 9; .NET 8; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
Смотрите также