Dim caption As String = "SetSignaturePosFromPlaceHolder"
Dim gdpicturePDF As New GdPicturePDF()
'Please take a PDF document created in the example for the AddSignatureFormField() method.
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test_AddSignatureFormField.pdf", False)
If status <> GdPictureStatus.OK Then
MessageBox.Show("The file can't be loaded.", caption)
GoTo [error]
End If
'Please set the corresponding certificate - this is a mandatory step.
'Set the signature information. At least one parameter must be defined for the successful signing.
status = gdpicturePDF.SetSignatureInfo("Orpalis", "GdPicturePDF", "Toulouse (France)", "")
If status <> GdPictureStatus.OK Then
MessageBox.Show("The method SetSignatureInfo() has failed with the status " + status.ToString(), caption)
GoTo [error]
End If
'Find a placeholder for a signature.
Dim signatureCount As Integer = gdpicturePDF.GetSignatureCount()
'This step is strongly bound to the file "test_AddSignatureFormField.pdf".
If (gdpicturePDF.GetStat() = GdPictureStatus.OK) AndAlso (signatureCount = 1) Then
'Set the signature's location on the current page. This step is optional.
'If this step is omitted, the signature will be invisible.
status = gdpicturePDF.SetSignaturePosFromPlaceHolder(signatureCount - 1)
If status <> GdPictureStatus.OK Then
MessageBox.Show("The method SetSignaturePosFromPlaceHolder() has failed with the status: " + status.ToString(), caption)
GoTo [error]
End If
Else
MessageBox.Show("Can't find a signature placeholder field." + gdpicturePDF.GetStat().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 = "SetSignaturePosFromPlaceHolder";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
//Please take a PDF document created in the example for the AddSignatureFormField() method.
GdPictureStatus status = gdpicturePDF.LoadFromFile("test_AddSignatureFormField.pdf", false);
if (status != GdPictureStatus.OK)
{
MessageBox.Show("The file can't be loaded.", caption);
goto error;
}
//Please set the corresponding certificate - this is a mandatory step.
//Set the signature information. At least one parameter must be defined for the successful signing.
status = gdpicturePDF.SetSignatureInfo("Orpalis", "GdPicturePDF", "Toulouse (France)", "");
if (status != GdPictureStatus.OK)
{
MessageBox.Show("The method SetSignatureInfo() has failed with the status " + status.ToString(), caption);
goto error;
}
//Find a placeholder for a signature.
int signatureCount = gdpicturePDF.GetSignatureCount();
//This step is strongly bound to the file "test_AddSignatureFormField.pdf".
if ((gdpicturePDF.GetStat() == GdPictureStatus.OK) && (signatureCount == 1))
{
//Set the signature's location on the current page. This step is optional.
//If this step is omitted, the signature will be invisible.
status = gdpicturePDF.SetSignaturePosFromPlaceHolder(signatureCount - 1);
if (status != GdPictureStatus.OK)
{
MessageBox.Show("The method SetSignaturePosFromPlaceHolder() has failed with the status: " + status.ToString(), caption);
goto error;
}
}
else
{
MessageBox.Show("Can't find a signature placeholder field." + gdpicturePDF.GetStat().ToString(), caption);
goto error;
}
//Please see the complete sample in the ApplySignature() method for next steps to follow
error:
gdpicturePDF.Dispose();