GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / DisplayFromIStream Method
A System.IO.IStream 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.
The password to be used to decrypt the PDF document, if that is stored in the Stream parameter, allowing the control to read its content. Use the empty string to allow the control to automatically prompts users to enter a correct password and also for files with no encryption.





In This Topic
DisplayFromIStream Method (GdViewer)
In This Topic
Loads a document from an instantiated IStream 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.

This method is especially useful for encrypted PDF documents, as you are allowed to enter a password to decrypt the document for reading its content.

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.

Syntax
'Declaration
 
Public Function DisplayFromIStream( _
   ByVal Stream As IStream, _
   ByVal Password As String _
) As GdPictureStatus
public GdPictureStatus DisplayFromIStream( 
   IStream Stream,
   string Password
)
public function DisplayFromIStream( 
    Stream: IStream;
    Password: String
): GdPictureStatus; 
public function DisplayFromIStream( 
   Stream : IStream,
   Password : String
) : GdPictureStatus;
public: GdPictureStatus DisplayFromIStream( 
   IStream* Stream,
   string* Password
) 
public:
GdPictureStatus DisplayFromIStream( 
   IStream^ Stream,
   String^ Password
) 

Parameters

Stream
A System.IO.IStream 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.
Password
The password to be used to decrypt the PDF document, if that is stored in the Stream parameter, allowing the control to read its content. Use the empty string to allow the control to automatically prompts users to enter a correct password and also for files with no encryption.

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
Just to remind you that you can use the empty string as a Password parameter to allow the control to automatically pop up a dialog box for entering a correct password if the source document is encrypted PDF file and also for files with no encryption.

Likewise, both the BeforeDocumentChange and the AfterDocumentChange events are raised using this method.

Example
IStream is an interface, so you don't create an IStream object directly, you should rather implement this interface and then pass your object. From that reason we don't add any example here.
See Also