Dim caption As String = "Example: EnableCompression"
Using gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
gdpicturePDF.EnableCompression(True)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If gdpicturePDF.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
gdpicturePDF.EnableCompression(False)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If gdpicturePDF.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 gdpicturePDF = new GdPicturePDF())
{
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
gdpicturePDF.EnableCompression(true);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (gdpicturePDF.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);
}
gdpicturePDF.EnableCompression(false);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (gdpicturePDF.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);
}
}