GdPicture.NET.14
GdPicture14 Namespace / GdPictureDocumentConverter Class / LoadFromStream(Stream,DocumentFormat) Method
A stream object. This stream object must be initialized before it can be sent into this method and it should stay open for subsequent use.
A member of the DocumentFormat enumeration. Specifies a file format of the input document. Supported input document formats are listed here.
Example





In This Topic
LoadFromStream(Stream,DocumentFormat) Method
In This Topic
This method loads the source document from a previously instantiated stream object according to what you have specified.
Syntax
'Declaration
 
Public Function LoadFromStream( _
   ByVal Stream As Stream, _
   Optional ByVal DocumentFormat As DocumentFormat _
) As GdPictureStatus
public GdPictureStatus LoadFromStream( 
   Stream Stream,
   DocumentFormat DocumentFormat
)
public function LoadFromStream( 
    Stream: Stream;
    DocumentFormat: DocumentFormat
): GdPictureStatus; 
public function LoadFromStream( 
   Stream : Stream,
   DocumentFormat : DocumentFormat
) : GdPictureStatus;
public: GdPictureStatus LoadFromStream( 
   Stream* Stream,
   DocumentFormat DocumentFormat
) 
public:
GdPictureStatus LoadFromStream( 
   Stream^ Stream,
   DocumentFormat DocumentFormat
) 

Parameters

Stream
A stream object. This stream object must be initialized before it can be sent into this method and it should stay open for subsequent use.
DocumentFormat
A member of the DocumentFormat enumeration. Specifies a file format of the input document. Supported input document formats are listed here.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
Remarks
The document's first page is automatically set as the current page after loading.

Keep noted that the input stream should remain open and can only be closed/disposed by the user after a call to GdPictureDocumentConverter.CloseDocument() is made.

Example
Saving the source TXT document as the resulting PDF document using a stream.
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    Using fileStream As System.IO.Stream = New System.IO.FileStream("input.txt", System.IO.FileMode.Open)
        ' Loading the source document.
        gdpictureDocumentConverter.LoadFromStream(fileStream, GdPicture14.DocumentFormat.DocumentFormatTXT)
        ' Saving as the PDF document.
        gdpictureDocumentConverter.SaveAsPDF("output.pdf", PdfConformance.PDF1_5)
    End Using
End Using
using (GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter())
{
    using (System.IO.Stream fileStream = new System.IO.FileStream("input.txt", System.IO.FileMode.Open))
    {
        // Loading the source document.
        gdpictureDocumentConverter.LoadFromStream(fileStream, GdPicture14.DocumentFormat.DocumentFormatTXT);
        // Saving as the PDF document.
        gdpictureDocumentConverter.SaveAsPDF("output.pdf", PdfConformance.PDF1_5);
    }
}
See Also