RemoveSignature Method (GdPicturePDF)
In This Topic
Removes a digital signature specified by its index from the currently loaded PDF document.
Syntax
Parameters
- SignatureIdx
- The 0-based signature index within the current document. It must be a value from 0 to GdPicturePDF.GetSignatureCount-1.
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.
Example
How to remove the specified digital signature from the current document.
Dim caption As String = "RemoveSignature"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.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
status = gdpicturePDF.RemoveSignature(signatureCount - 1)
If status = GdPictureStatus.OK Then
status = gdpicturePDF.SaveToFile("test_RemoveSignature.pdf")
If status = GdPictureStatus.OK Then
MessageBox.Show("The signature has been removed successfully and the file has been saved.", caption)
Else
MessageBox.Show("The signature has been removed successfully, but the file can't be saved. Status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The RemoveSignature() 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 = "RemoveSignature";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
int signatureCount = gdpicturePDF.GetSignatureCount();
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (signatureCount > 0)
{
status = gdpicturePDF.RemoveSignature(signatureCount - 1);
if (status == GdPictureStatus.OK)
{
status = gdpicturePDF.SaveToFile("test_RemoveSignature.pdf");
if (status == GdPictureStatus.OK)
MessageBox.Show("The signature has been removed successfully and the file has been saved.", caption);
else
MessageBox.Show("The signature has been removed successfully, but the file can't be saved. Status: " + status.ToString(), caption);
}
else
MessageBox.Show("The RemoveSignature() 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();
Example
How to remove the specified digital signature from the current document.
Dim caption As String = "RemoveSignature"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.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
status = gdpicturePDF.RemoveSignature(signatureCount - 1)
If status = GdPictureStatus.OK Then
status = gdpicturePDF.SaveToFile("test_RemoveSignature.pdf")
If status = GdPictureStatus.OK Then
MessageBox.Show("The signature has been removed successfully and the file has been saved.", caption)
Else
MessageBox.Show("The signature has been removed successfully, but the file can't be saved. Status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The RemoveSignature() 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 = "RemoveSignature";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
int signatureCount = gdpicturePDF.GetSignatureCount();
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (signatureCount > 0)
{
status = gdpicturePDF.RemoveSignature(signatureCount - 1);
if (status == GdPictureStatus.OK)
{
status = gdpicturePDF.SaveToFile("test_RemoveSignature.pdf");
if (status == GdPictureStatus.OK)
MessageBox.Show("The signature has been removed successfully and the file has been saved.", caption);
else
MessageBox.Show("The signature has been removed successfully, but the file can't be saved. Status: " + status.ToString(), caption);
}
else
MessageBox.Show("The RemoveSignature() 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