IDocumentBase.GetAsStream

Syntax

GetAsStream: IIOStream;

Description

The GetAsStream method creates a new stream connected to the given document.

Example

Executing the example requires a form with the Button1 button, the ImageBox component named ImageBox1 and the Document repository object with the Document_1 identifier.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    Doc: IDocument;
Begin
    MB := MetabaseClass.Active;
    Doc := MB.ItemById("Document_1").Bind As IDocument;
    If Doc.MimeType.IndexOf("image") <> -1 Then
        ImageBox1.LoadImageFromStream(Doc.GetAsStream);
    End If;
End Sub Button1OnClick;

After executing the example on pressing the button, if the document contains any graphic image, it is loaded in the ImageBox1 component.

See also:

IDocumentBase