Example





In This Topic

CloseDocument Method (GdPictureDocumentConverter)

In This Topic
Closes the currently loaded 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.
Remarks
Instead of calling this method in most cases just ensure that the object is properly disposed.
Example
Saving the source DOCX document as the resulting PDF document.
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Loading the source document.
    gdpictureDocumentConverter.LoadFromFile("input.docx", GdPicture14.DocumentFormat.DocumentFormatDOCX)
    ' Saving as the PDF document.
    gdpictureDocumentConverter.SaveAsPDF("output.pdf", PdfConformance.PDF1_5)
    ' Closing the document.
    gdpictureDocumentConverter.CloseDocument()
End Using
using GdPicture14;
            
using GdPictureDocumentConverter converter = new();
GdPictureStatus status = converter.LoadFromFile("input.pdf");
if (status != GdPictureStatus.OK)
{
    throw new Exception(status.ToString());
}
            
status = converter.SaveAsDOCX("output.docx");
if (status != GdPictureStatus.OK)
{
    throw new Exception(status.ToString());
}
            
Console.WriteLine("The input document has been converted to a docx file");
            
converter.CloseDocument();
See Also