Dim caption As String = "Example: LoadFromFile"
Using gdpicturePDF As New GdPicturePDF()
'The file will load into memory.
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", True)
If status = GdPictureStatus.OK Then
If gdpicturePDF.ClonePage(1) = GdPictureStatus.OK Then
'The file will be overwritten.
status = gdpicturePDF.SaveToFile("test.pdf")
If status = GdPictureStatus.OK Then
MessageBox.Show("The PDF file has been overwritten and saved successfully.", caption)
Else
MessageBox.Show("The file can't be saved. Status: " + status.ToString(), caption)
End If
End If
gdpicturePDF.CloseDocument()
'The file will not load into memory.
status = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
If gdpicturePDF.DeletePage(1) = GdPictureStatus.OK Then
'The file will not be overwritten.
status = gdpicturePDF.SaveToFile("test.pdf")
If status = GdPictureStatus.OK Then
MessageBox.Show("The PDF file has been overwritten and saved successfully.", caption)
Else
MessageBox.Show("The file can't be saved. Status: " + status.ToString(), caption)
End If
End If
gdpicturePDF.CloseDocument()
Else
MessageBox.Show("The file can't be opened. Status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The file can't be opened. Status: " + status.ToString(), caption)
End If
End Using
string caption = "Example: LoadFromFile";
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
//The file will load into memory.
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", true);
if (status == GdPictureStatus.OK)
{
if (gdpicturePDF.ClonePage(1) == GdPictureStatus.OK)
{
//The file will be overwritten.
status = gdpicturePDF.SaveToFile("test.pdf");
if (status == GdPictureStatus.OK)
{
MessageBox.Show("The PDF file has been overwritten and saved successfully.", caption);
}
else
{
MessageBox.Show("The file can't be saved. Status: " + status.ToString(), caption);
}
}
gdpicturePDF.CloseDocument();
//The file will not load into memory.
status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
if (gdpicturePDF.DeletePage(1) == GdPictureStatus.OK)
{
//The file will not be overwritten.
status = gdpicturePDF.SaveToFile("test.pdf");
if (status == GdPictureStatus.OK)
{
MessageBox.Show("The PDF file has been overwritten and saved successfully.", caption);
}
else
{
MessageBox.Show("The file can't be saved. Status: " + status.ToString(), caption);
}
}
gdpicturePDF.CloseDocument();
}
else
{
MessageBox.Show("The file can't be opened. Status: " + status.ToString(), caption);
}
}
else
{
MessageBox.Show("The file can't be opened. Status: " + status.ToString(), caption);
}
}