GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / CloseDocument Method
Example





In This Topic
CloseDocument Method (GdPicturePDF)
In This Topic
Closes the currently loaded PDF document and releases any related resources from memory.
Syntax
'Declaration
 
Public Function CloseDocument() As GdPictureStatus
public GdPictureStatus CloseDocument()
public function CloseDocument(): GdPictureStatus; 
public function CloseDocument() : GdPictureStatus;
public: GdPictureStatus CloseDocument(); 
public:
GdPictureStatus CloseDocument(); 

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.

Remarks
Instead of calling this method in most cases just ensure that the object is properly disposed of.
Example
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");
    }
}
See Also