Dim caption As String = "Example: EnableCompression"
Using oGdPicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = oGdPicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
oGdPicturePDF.EnableCompression(True)
status = oGdPicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If oGdPicturePDF.SaveToFile("test_EnableCompression.pdf") = GdPictureStatus.OK Then
MessageBox.Show("The file has been successfully compressed and saved.", caption)
End If
Else
MessageBox.Show("The EnableCompression() method has failed with the status: " + status.ToString(), caption)
End If
oGdPicturePDF.EnableCompression(False)
status = oGdPicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If oGdPicturePDF.SaveToFile("test_DisableCompression.pdf") = GdPictureStatus.OK Then
MessageBox.Show("The file has been successfully saved without compression.", caption)
End If
Else
MessageBox.Show("The EnableCompression() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
End Using
string caption = "Example: EnableCompression";
using (GdPicturePDF oGdPicturePDF = new GdPicturePDF())
{
GdPictureStatus status = oGdPicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
oGdPicturePDF.EnableCompression(true);
status = oGdPicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (oGdPicturePDF.SaveToFile("test_EnableCompression.pdf") == GdPictureStatus.OK)
{
MessageBox.Show("The file has been successfully compressed and saved.", caption);
}
}
else
{
MessageBox.Show("The EnableCompression() method has failed with the status: " + status.ToString(), caption);
}
oGdPicturePDF.EnableCompression(false);
status = oGdPicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (oGdPicturePDF.SaveToFile("test_DisableCompression.pdf") == GdPictureStatus.OK)
{
MessageBox.Show("The file has been successfully saved without compression.", caption);
}
}
else
{
MessageBox.Show("The EnableCompression() method has failed with the status: " + status.ToString(), caption);
}
}
else
{
MessageBox.Show("The file can't be loaded.", caption);
}
}