CloseDocument Method (GdPicturePDF)
Closes the currently loaded PDF document and releases any related resources from memory.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
We strongly recommend always checking this status first.
How to determine the number of pages in the PDF document.
Using gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
Dim pageCount As Integer = gdpicturePDF.GetPageCount()
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
MessageBox.Show("This document contains " + pageCount.ToString() + " pages.", "Example: CloseDocument")
End If
status = gdpicturePDF.CloseDocument()
If status <> GdPictureStatus.OK Then
MessageBox.Show("The CloseDocument() method has failed with the status: " + status.ToString(), "Example: CloseDocument")
End If
Else
MessageBox.Show("The file can't be loaded.", "Example: CloseDocument")
End If
End Using
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
int pageCount = gdpicturePDF.GetPageCount();
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
MessageBox.Show("This document contains " + pageCount.ToString() + " pages.", "Example: CloseDocument");
status = gdpicturePDF.CloseDocument();
if (status != GdPictureStatus.OK)
MessageBox.Show("The CloseDocument() method has failed with the status: " + status.ToString(), "Example: CloseDocument");
}
else
{
MessageBox.Show("The file can't be loaded.", "Example: CloseDocument");
}
}