DisplayFromStream(Stream) Method
Loads a document from an instantiated Stream object according to what you have specified and subsequently displays it in the GdViewer control. The document previously displayed in the control will automatically close.
All document formats currently supported by the toolkit are listed here.
The BeforeDocumentChange and the AfterDocumentChange events are raised just before and right after the document is displayed in the GdViewer control. Both events are only raised if the document has been successfully loaded.
'Declaration
Public Overloads Function DisplayFromStream( _
ByVal As Stream _
) As GdPictureStatus
Parameters
- Stream
- A System.IO.Stream object. This object must be properly initialized before it can be sent into this method and it must be disposed of by the user as well.
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 display your PDF document from a stream.
'We assume that the GdViewer1 control has been properly integrated.
Dim file As System.IO.Stream = New System.IO.FileStream("image.tif", System.IO.FileMode.Open)
If GdViewer1.DisplayFromStream(file) = GdPictureStatus.OK Then
'Do your stuff here.
Else
MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromStream")
End If
file.Dispose()
//We assume that the GdViewer1 control has been properly integrated.
System.IO.Stream file = new System.IO.FileStream("image.tif", System.IO.FileMode.Open);
if (GdViewer1.DisplayFromStream(file) == GdPictureStatus.OK)
{
//Do your stuff here.
}
else
{
MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromStream");
}
file.Dispose();