CloseDocument Method (GdPicturePDF)
                In This Topic
            
            Closes the currently loaded PDF document and releases any related resources from memory.
            
            
            Syntax
            
        
            
            
            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.
 
            
            
            
            
            
            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");
    }
}
	 
	
 
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