Dim caption As String = "Example: GetEncryptionMode"
Dim gdpicturePDF As New GdPicturePDF()
'Please see the example in the SetPassword method for creating this file.
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("encrypted.pdf", False)
If status = GdPictureStatus.OK Then
Dim emode As PdfEncryptionMode = PdfEncryptionMode.UnKnown
If gdpicturePDF.IsEncrypted() Then
emode = gdpicturePDF.GetEncryptionMode()
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
MessageBox.Show("This PDF document is encrypted, the security handler is: " + emode.ToString(), caption)
Else
MessageBox.Show("The GetEncryptionMode() method has failed with the status: " + status.ToString(), caption)
End If
'You need to provide the correct password here.
If gdpicturePDF.SetPassword("user") = GdPictureStatus.OK Then
emode = gdpicturePDF.GetEncryptionMode()
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
MessageBox.Show("This PDF document has been decrypted, the security handler is: " + emode.ToString(), caption)
End If
End If
Else
emode = gdpicturePDF.GetEncryptionMode()
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
MessageBox.Show("The PDF document is not encrypted. The security handler is: " + emode.ToString(), caption)
End If
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetEncryptionMode";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
//Please see the example in the SetPassword method for creating this file.
GdPictureStatus status = gdpicturePDF.LoadFromFile("encrypted.pdf", false);
if (status == GdPictureStatus.OK)
{
PdfEncryptionMode emode = PdfEncryptionMode.UnKnown;
if (gdpicturePDF.IsEncrypted())
{
emode = gdpicturePDF.GetEncryptionMode();
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
MessageBox.Show("This PDF document is encrypted, the security handler is: " + emode.ToString(), caption);
}
else
{
MessageBox.Show("The GetEncryptionMode() method has failed with the status: " + status.ToString(), caption);
}
//You need to provide the correct password here.
if (gdpicturePDF.SetPassword("user") == GdPictureStatus.OK)
{
emode = gdpicturePDF.GetEncryptionMode();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
MessageBox.Show("This PDF document has been decrypted, the security handler is: " + emode.ToString(), caption);
}
}
}
else
{
emode = gdpicturePDF.GetEncryptionMode();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
MessageBox.Show("The PDF document is not encrypted. The security handler is: " + emode.ToString(), caption);
}
}
}
else
{
MessageBox.Show("The file can't be loaded.", caption);
}
gdpicturePDF.Dispose();