GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / GetSignatureProperties Method
The signature index. It must be a value from 0 to GdPicturePDF.GetSignatureCount-1.
Output parameter. The name of the person or authority signing the document. Since it is an optional information, the returned value can be an empty string.
Output parameter. The reason for the signing the document. Since it is an optional information, the returned value can be an empty string.
Output parameter. The CPU host name or physical location of the signing. Since it is an optional information, the returned value can be an empty string.
Output parameter. Information provided by the signer to enable a recipient to contact the signer to verify the signature, for example a phone number. Since it is an optional information, the returned value can be an empty string.
Output parameter. The time of signing as a string. Depending on the signature handler, this may be a normal unverified computer time or a time generated in a verifiable way from a secure time server.
Output parameter. The horizontal (X) coordinate of the closest point to the currently defined origin, where the signature is located. The returned value is expressed in the current units specified by the SetMeasurementUnit method and it is related to the page, where the signature is situated.
Output parameter. The vertical (Y) coordinate of the closest point to the currently defined origin, where the signature is located. The returned value is expressed in the current units specified by the SetMeasurementUnit method and it is related to the page, where the signature is situated.
Output parameter. The width of the signature's bounding box, expressed in the current units specified by the SetMeasurementUnit method. If the returned value is 0, the signature is invisible.
Output parameter. The height of the signature's bounding box, expressed in the current units specified by the SetMeasurementUnit method. If the returned value is 0, the signature is invisible.
Output parameter. The number of the page, on which the signature is placed.
Output parameter. true, if the document has been altered or corrupted since it was signed, otherwise false.
Output parameter. true, if the used certificate (digital ID) has been successfully verified, otherwise false.
Output parameter. The associated alias of the used certificate, that means the name of the certificate's owner.
Output parameter. The name of the authority that issued the used certificate.
Output parameter. The earliest time and date on which the used certificate is valid.
Output parameter. The time and date past which the used certificate is no longer valid.
Output parameter. The entity the used certificate belongs to, for example an individual or an organization.
Output parameter. The version of the used certificate.
Output parameter. The date and time when the document has been signed. This value should be used only when the time of signing is not available in the signature.
Output parameter. A member of the PdfSignatureCertificationLevel enumeration. The used level of the signature certification.
Example





In This Topic
GetSignatureProperties Method (GdPicturePDF)
In This Topic
Retrieves available information about the applied digital signature specified by its index in the currently loaded PDF document, as well as about the used certificate (digital ID). This method also checks the certificate validity and if the document has been altered or corrupted since it was signed.
Syntax
'Declaration
 
Public Function GetSignatureProperties( _
   ByVal SignatureIdx As Integer, _
   ByRef SignatureName As String, _
   ByRef SignatureReason As String, _
   ByRef SignatureLocation As String, _
   ByRef SignatureContactInfo As String, _
   ByRef SignatureDate As String, _
   ByRef StampLeft As Single, _
   ByRef StampTop As Single, _
   ByRef StampWidth As Single, _
   ByRef StampHeight As Single, _
   ByRef StampPage As Integer, _
   ByRef DocumentValid As Boolean, _
   ByRef CertificateValid As Boolean, _
   ByRef CertificateFriendlyName As String, _
   ByRef CertificateIssuer As String, _
   ByRef CertificateNotBefore As Date, _
   ByRef CertificateNotAfter As Date, _
   ByRef CertificateSubject As String, _
   ByRef CertificateVersion As Integer, _
   ByRef SigningTime As Date, _
   ByRef SignatureLevel As PdfSignatureCertificationLevel _
) As GdPictureStatus
public GdPictureStatus GetSignatureProperties( 
   int SignatureIdx,
   ref string SignatureName,
   ref string SignatureReason,
   ref string SignatureLocation,
   ref string SignatureContactInfo,
   ref string SignatureDate,
   ref float StampLeft,
   ref float StampTop,
   ref float StampWidth,
   ref float StampHeight,
   ref int StampPage,
   ref bool DocumentValid,
   ref bool CertificateValid,
   ref string CertificateFriendlyName,
   ref string CertificateIssuer,
   ref DateTime CertificateNotBefore,
   ref DateTime CertificateNotAfter,
   ref string CertificateSubject,
   ref int CertificateVersion,
   ref DateTime SigningTime,
   ref PdfSignatureCertificationLevel SignatureLevel
)
public function GetSignatureProperties( 
    SignatureIdx: Integer;
   var  SignatureName: String;
   var  SignatureReason: String;
   var  SignatureLocation: String;
   var  SignatureContactInfo: String;
   var  SignatureDate: String;
   var  StampLeft: Single;
   var  StampTop: Single;
   var  StampWidth: Single;
   var  StampHeight: Single;
   var  StampPage: Integer;
   var  DocumentValid: Boolean;
   var  CertificateValid: Boolean;
   var  CertificateFriendlyName: String;
   var  CertificateIssuer: String;
   var  CertificateNotBefore: DateTime;
   var  CertificateNotAfter: DateTime;
   var  CertificateSubject: String;
   var  CertificateVersion: Integer;
   var  SigningTime: DateTime;
   var  SignatureLevel: PdfSignatureCertificationLevel
): GdPictureStatus; 
public function GetSignatureProperties( 
   SignatureIdx : int,
   SignatureName : String,
   SignatureReason : String,
   SignatureLocation : String,
   SignatureContactInfo : String,
   SignatureDate : String,
   StampLeft : float,
   StampTop : float,
   StampWidth : float,
   StampHeight : float,
   StampPage : int,
   DocumentValid : boolean,
   CertificateValid : boolean,
   CertificateFriendlyName : String,
   CertificateIssuer : String,
   CertificateNotBefore : DateTime,
   CertificateNotAfter : DateTime,
   CertificateSubject : String,
   CertificateVersion : int,
   SigningTime : DateTime,
   SignatureLevel : PdfSignatureCertificationLevel
) : GdPictureStatus;
public: GdPictureStatus GetSignatureProperties( 
   int SignatureIdx,
   ref string* SignatureName,
   ref string* SignatureReason,
   ref string* SignatureLocation,
   ref string* SignatureContactInfo,
   ref string* SignatureDate,
   ref float StampLeft,
   ref float StampTop,
   ref float StampWidth,
   ref float StampHeight,
   ref int StampPage,
   ref bool DocumentValid,
   ref bool CertificateValid,
   ref string* CertificateFriendlyName,
   ref string* CertificateIssuer,
   ref DateTime CertificateNotBefore,
   ref DateTime CertificateNotAfter,
   ref string* CertificateSubject,
   ref int CertificateVersion,
   ref DateTime SigningTime,
   ref PdfSignatureCertificationLevel SignatureLevel
) 
public:
GdPictureStatus GetSignatureProperties( 
   int SignatureIdx,
   String^% SignatureName,
   String^% SignatureReason,
   String^% SignatureLocation,
   String^% SignatureContactInfo,
   String^% SignatureDate,
   float% StampLeft,
   float% StampTop,
   float% StampWidth,
   float% StampHeight,
   int% StampPage,
   bool% DocumentValid,
   bool% CertificateValid,
   String^% CertificateFriendlyName,
   String^% CertificateIssuer,
   DateTime% CertificateNotBefore,
   DateTime% CertificateNotAfter,
   String^% CertificateSubject,
   int% CertificateVersion,
   DateTime% SigningTime,
   PdfSignatureCertificationLevel% SignatureLevel
) 

Parameters

SignatureIdx
The signature index. It must be a value from 0 to GdPicturePDF.GetSignatureCount-1.
SignatureName
Output parameter. The name of the person or authority signing the document. Since it is an optional information, the returned value can be an empty string.
SignatureReason
Output parameter. The reason for the signing the document. Since it is an optional information, the returned value can be an empty string.
SignatureLocation
Output parameter. The CPU host name or physical location of the signing. Since it is an optional information, the returned value can be an empty string.
SignatureContactInfo
Output parameter. Information provided by the signer to enable a recipient to contact the signer to verify the signature, for example a phone number. Since it is an optional information, the returned value can be an empty string.
SignatureDate
Output parameter. The time of signing as a string. Depending on the signature handler, this may be a normal unverified computer time or a time generated in a verifiable way from a secure time server.
StampLeft
Output parameter. The horizontal (X) coordinate of the closest point to the currently defined origin, where the signature is located. The returned value is expressed in the current units specified by the SetMeasurementUnit method and it is related to the page, where the signature is situated.
StampTop
Output parameter. The vertical (Y) coordinate of the closest point to the currently defined origin, where the signature is located. The returned value is expressed in the current units specified by the SetMeasurementUnit method and it is related to the page, where the signature is situated.
StampWidth
Output parameter. The width of the signature's bounding box, expressed in the current units specified by the SetMeasurementUnit method. If the returned value is 0, the signature is invisible.
StampHeight
Output parameter. The height of the signature's bounding box, expressed in the current units specified by the SetMeasurementUnit method. If the returned value is 0, the signature is invisible.
StampPage
Output parameter. The number of the page, on which the signature is placed.
DocumentValid
Output parameter. true, if the document has been altered or corrupted since it was signed, otherwise false.
CertificateValid
Output parameter. true, if the used certificate (digital ID) has been successfully verified, otherwise false.
CertificateFriendlyName
Output parameter. The associated alias of the used certificate, that means the name of the certificate's owner.
CertificateIssuer
Output parameter. The name of the authority that issued the used certificate.
CertificateNotBefore
Output parameter. The earliest time and date on which the used certificate is valid.
CertificateNotAfter
Output parameter. The time and date past which the used certificate is no longer valid.
CertificateSubject
Output parameter. The entity the used certificate belongs to, for example an individual or an organization.
CertificateVersion
Output parameter. The version of the used certificate.
SigningTime
Output parameter. The date and time when the document has been signed. This value should be used only when the time of signing is not available in the signature.
SignatureLevel
Output parameter. A member of the PdfSignatureCertificationLevel enumeration. The used level of the signature certification.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents.

Be aware that the values of the coordinates and dimensions are expressed in the current units defined by the GdPicturePDF.SetMeasurementUnit method according to the current coordinate space defined by the GdPicturePDF.SetOrigin method.

This method requires the Digital Signatures component to run.

Example
How to retrieve and show properties of the first signature of the PDF document.
Dim caption As String = "GetSignatureProperties"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test_signed.pdf", False)
If status = GdPictureStatus.OK Then
    Dim signatureCount As Integer = gdpicturePDF.GetSignatureCount()
    status = gdpicturePDF.GetStat()
    If status = GdPictureStatus.OK Then
        If signatureCount > 0 Then
            Dim sigName As String = "", sigReason As String = "", sigLocation As String = "", sigInfo As String = "", sigDate As String = "",
                certFriendName As String = "", certIssuer As String = "", certSubject As String = ""
            Dim stampLeft As Single = 0, stampTop As Single = 0, stampWidth As Single = 0, stampHeight As Single = 0
            Dim stampPage As Integer = 0, certVersion As Integer = 0
            Dim docValid As Boolean = False, certValid As Boolean = False
            Dim certNotBefore As New DateTime(), certNotAfter As New DateTime(), sigTime As New DateTime()
            Dim sigLevel As PdfSignatureCertificationLevel = PdfSignatureCertificationLevel.NotCertified
            status = gdpicturePDF.GetSignatureProperties(0, sigName, sigReason, sigLocation, sigInfo, sigDate,
                                                          stampLeft, stampTop, stampWidth, stampHeight, stampPage,
                                                          docValid, certValid, certFriendName, certIssuer, certNotBefore, certNotAfter, certSubject, certVersion, sigTime, sigLevel)
            
            If status = GdPictureStatus.OK Then
                Dim message As String = "The 1. signature is located on the page " + stampPage.ToString() + " at the coordinates " + stampLeft.ToString() + ", " + stampTop.ToString()
            
                If (stampWidth = 0) OrElse (stampHeight = 0) Then
                    message = message + ", the signature is invisible,"
                Else
                    message = message + " with the width of " + stampWidth.ToString() + " and the height of " + stampHeight.ToString()
                End If
            
                message = message + " and the certificate level is set to " + sigLevel.ToString() + ". The next properties are:" + vbCrLf
            
                If docValid Then
                    message = message + "The document has not been changed after signing." + vbCrLf
                Else
                    message = message + "The document has been changed after signing." + vbCrLf
                End If
            
                If certValid Then
                    message = message + "The signature is valid." + vbCrLf
                Else
                    message = message + "The signature is not valid." + vbCrLf
                End If
            
                message = message + "Signature Info:" + vbCrLf + "  Name: " + sigName + vbCrLf + "  Reason: " + sigReason + vbCrLf + "  Location: " + sigLocation + vbCrLf + "  Contact info: " + sigInfo + vbCrLf + "  Date: " + sigDate + vbCrLf +
                                    "Certificate Info:" + vbCrLf + "  Name: " + certFriendName + vbCrLf + "  Issuer: " + certIssuer + vbCrLf + "  Subject: " + certSubject + vbCrLf + "  Version: " + certVersion + vbCrLf + " Time: " + sigTime.ToString() + vbCrLf +
                                    "Certificate validity - not before " + certNotBefore.ToString() + " and not after " + certNotAfter.ToString() + "."
            
                MessageBox.Show(message, caption)
            Else
                MessageBox.Show("The GetSignatureProperties() method has failed with the status: " + status.ToString(), caption)
            End If
        Else
            MessageBox.Show("This PDF document doesn't contain any digital signature.", caption)
        End If
    Else
        MessageBox.Show("The GetSignatureCount() method has failed with the status: " + status.ToString(), caption)
    End If
Else
    MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "GetSignatureProperties";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test_signed.pdf", false);
if (status == GdPictureStatus.OK)
{
    int signatureCount = gdpicturePDF.GetSignatureCount();
    status = gdpicturePDF.GetStat();
    if (status == GdPictureStatus.OK)
    {
        if (signatureCount > 0)
        {
            string sigName = "", sigReason = "", sigLocation = "", sigInfo = "", sigDate = "", certFriendName = "", certIssuer = "", certSubject = "";
            float stampLeft = 0, stampTop = 0, stampWidth = 0, stampHeight = 0;
            int stampPage = 0, certVersion = 0;
            bool docValid = false, certValid = false;
            DateTime certNotBefore = new DateTime(), certNotAfter = new DateTime(), sigTime = new DateTime();
            PdfSignatureCertificationLevel sigLevel = PdfSignatureCertificationLevel.NotCertified;
            status = gdpicturePDF.GetSignatureProperties(0, ref sigName, ref sigReason, ref sigLocation, ref sigInfo, ref sigDate,
                                                          ref stampLeft, ref stampTop, ref stampWidth, ref stampHeight, ref stampPage,
                                                          ref docValid, ref certValid, ref certFriendName, ref certIssuer,
                                                          ref certNotBefore, ref certNotAfter, ref certSubject, ref certVersion, ref sigTime, ref sigLevel);
            
            if (status == GdPictureStatus.OK)
            {
                string message = "The 1. signature is located on the page " + stampPage.ToString() + " at the coordinates " + stampLeft.ToString() + ", " + stampTop.ToString();
            
                if ((stampWidth == 0) || (stampHeight == 0))
                    message = message + ", the signature is invisible,";
                else
                    message = message + " with the width of " + stampWidth.ToString() + " and the height of " + stampHeight.ToString();
            
                message = message + " and the certificate level is set to " + sigLevel.ToString() + ". The next properties are:\n";
            
                if (docValid)
                    message = message + "The document has not been changed after signing.\n";
                else
                    message = message + "The document has been changed after signing.\n";
            
                if (certValid)
                    message = message + "The signature is valid.\n";
                else
                    message = message + "The signature is not valid.\n";
            
                message = message + "Signature Info:\n  Name: " + sigName + "\n  Reason: " + sigReason + "\n  Location: " + sigLocation + "\n  Contact info: " + sigInfo + "\n  Date: " + sigDate +
                                    "\nCertificate Info:\n  Name: " + certFriendName + "\n  Issuer: " + certIssuer + "\n  Subject: " + certSubject + "\n  Version: " + certVersion + "\n Time: " + sigTime.ToString() +
                                    "\nCertificate validity - not before " + certNotBefore.ToString() + " and not after " + certNotAfter.ToString() + ".";
            
                MessageBox.Show(message, caption);
            }
            else
                MessageBox.Show("The GetSignatureProperties() method has failed with the status: " + status.ToString(), caption);
        }
        else
            MessageBox.Show("This PDF document doesn't contain any digital signature.", caption);
    }
    else
        MessageBox.Show("The GetSignatureCount() method has failed with the status: " + status.ToString(), caption);
}
else
    MessageBox.Show("The file can't be loaded.", caption);
gdpicturePDF.Dispose();
See Also