Dim caption As String = "Example: ClearPageContent"
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
Dim count As Integer = gdpicturePDF.GetPageCount()
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If count > 0 Then
status = gdpicturePDF.SelectPage(1)
If status = GdPictureStatus.OK Then
status = gdpicturePDF.ClearPageContent()
If status = GdPictureStatus.OK Then
Dim message As String = "The pages have been cleared successfully"
If gdpicturePDF.SaveToFile("test_ClearPageContent.pdf") = GdPictureStatus.OK Then
message = message + " and the file has been saved."
Else
message = message + ", but the file can't be saved."
End If
MessageBox.Show(message, caption)
Else
MessageBox.Show("The ClearPageContent() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The page can't be selected.", caption)
End If
Else
MessageBox.Show("This document contains no pages.", caption)
End If
Else
MessageBox.Show("The GetPageCount() 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 = "Example: ClearPageContent";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
int count = gdpicturePDF.GetPageCount();
GdPictureStatus status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (count > 0)
{
status = gdpicturePDF.SelectPage(1);
if (status == GdPictureStatus.OK)
{
status = gdpicturePDF.ClearPageContent();
if (status == GdPictureStatus.OK)
{
string message = "The pages have been cleared successfully";
if (gdpicturePDF.SaveToFile("test_ClearPageContent.pdf") == GdPictureStatus.OK)
message = message + " and the file has been saved.";
else
message = message + ", but the file can't be saved.";
MessageBox.Show(message, caption);
}
else
MessageBox.Show("The ClearPageContent() method has failed with the status: " + status.ToString(), caption);
}
else
MessageBox.Show("The page can't be selected.", caption);
}
else
MessageBox.Show("This document contains no pages.", caption);
}
else
MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), caption);
}
else
MessageBox.Show("The file can't be loaded.", caption);
gdpicturePDF.Dispose();