GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / SetSignatureCertificateFromSmartCardBySerialNumber Method
The serial number of the certificate to be used for the subsequent signing. Use the empty string to allow the application to give you the list of available certificates. Be aware that the serial number string is not case sensitive.
The pin code of the smart card. Use the empty string to allow the application to ask for the correct pin code at the signing time.
Example





In This Topic
SetSignatureCertificateFromSmartCardBySerialNumber Method (GdPicturePDF)
In This Topic
Sets up the certificate, contained in the digital ID, from a Smart Card reader, specified by its serial number. This certificate is later used for the subsequent signing of the currently loaded PDF document.
Syntax
'Declaration
 
Public Function SetSignatureCertificateFromSmartCardBySerialNumber( _
   ByVal SerialNumber As String, _
   ByVal PinCode As String _
) As GdPictureStatus
public GdPictureStatus SetSignatureCertificateFromSmartCardBySerialNumber( 
   string SerialNumber,
   string PinCode
)
public function SetSignatureCertificateFromSmartCardBySerialNumber( 
    SerialNumber: String;
    PinCode: String
): GdPictureStatus; 
public function SetSignatureCertificateFromSmartCardBySerialNumber( 
   SerialNumber : String,
   PinCode : String
) : GdPictureStatus;
public: GdPictureStatus SetSignatureCertificateFromSmartCardBySerialNumber( 
   string* SerialNumber,
   string* PinCode
) 
public:
GdPictureStatus SetSignatureCertificateFromSmartCardBySerialNumber( 
   String^ SerialNumber,
   String^ PinCode
) 

Parameters

SerialNumber
The serial number of the certificate to be used for the subsequent signing. Use the empty string to allow the application to give you the list of available certificates. Be aware that the serial number string is not case sensitive.
PinCode
The pin code of the smart card. Use the empty string to allow the application to ask for the correct pin code at the signing time.

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.

You also need to be aware that setting up the valid certificate is the mandatory step to be able to digitally sign the PDF document. Please select the appropriate method for carrying out this requirement according to your preference before you start the signing process.

Just to remind you that you can use the empty string if you are not sure about the correct serial number of your certificate as well as for the pin code. The application pops up a window to allow you to select a correct certificate and also the application asks for the correct pin code at the signing time.

This method requires the Digital Signatures component to run.

Example
How to set up the certificate (digital ID) from a Smart Card reader for the subsequent signing. You can find the complete sample within the ApplySignature() method's example.
Dim caption As String = "SetSignatureCertificateFromSmartCardBySerialNumber"
Dim gdpicturePDF As New GdPicturePDF()
            
'Please load the PDF document you want to sign.
            
'This is the first step in the signing process. It is the mandatory step. Select the method according to your preference.
Dim status As GdPictureStatus = gdpicturePDF.SetSignatureCertificateFromSmartCardBySerialNumber("", "")
If status <> GdPictureStatus.OK Then
    MessageBox.Show("The method SetSignatureCertificateFromSmartCardBySerialNumber() has failed with the status: " + status.ToString(), caption)
    Goto [Error]
End If
            
'Please see the complete sample in the ApplySignature() method for next steps to follow.
            
[error]:
gdpicturePDF.Dispose()
string caption = "SetSignatureCertificateFromSmartCardBySerialNumber";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
            
//Please load the PDF document you want to sign.
            
//This is the first step in the signing process. It is the mandatory step. Select the method according to your preference.
GdPictureStatus status = gdpicturePDF.SetSignatureCertificateFromSmartCardBySerialNumber("", "");
if (status != GdPictureStatus.OK)
{
    MessageBox.Show("The method SetSignatureCertificateFromSmartCardBySerialNumber() has failed with the status: " + status.ToString(), caption);
    goto error;
}
            
//Please see the complete sample in the ApplySignature() method for next steps to follow.
            
error:
gdpicturePDF.Dispose();
See Also