Reference Guide
GdPicture14 Namespace / GdPicturePDF Class / SaveToStream Method / SaveToStream(Stream) Method
A Stream object where the currently loaded PDF document will be saved to. This Stream object must be initialized before it can be sent into this method and it should remain open for subsequent use.
Example





In This Topic
    SaveToStream(Stream) Method
    In This Topic
    Saves the currently loaded PDF document to an instantiated Stream object according to what you have specified.
    Syntax
    'Declaration
     
    
    Public Overloads Function SaveToStream( _
       ByVal Stream As Stream _
    ) As GdPictureStatus
    public GdPictureStatus SaveToStream( 
       Stream Stream
    )
    public function SaveToStream( 
        Stream: Stream
    ): GdPictureStatus; 
    public function SaveToStream( 
       Stream : Stream
    ) : GdPictureStatus;
    public: GdPictureStatus SaveToStream( 
       Stream* Stream
    ) 
    public:
    GdPictureStatus SaveToStream( 
       Stream^ Stream
    ) 

    Parameters

    Stream
    A Stream object where the currently loaded PDF document will be saved to. This Stream object must be initialized before it can be sent into this method and it should remain open for subsequent use.

    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
    The output stream should be open for writing and should be closed/disposed of by the user as well.
    Example
    How to save the PDF document to a stream with enabled content compression.
    Dim oGdPicturePDF As New GdPicturePDF()
    Dim status As GdPictureStatus = oGdPicturePDF.LoadFromFile("test.pdf", False)
    If status = GdPictureStatus.OK Then
        Dim oFileStream As New System.IO.FileStream("test_SaveToStream.pdf", System.IO.FileMode.Create)
        oGdPicturePDF.EnableCompression(True)
        If oGdPicturePDF.GetStat() = GdPictureStatus.OK Then
            status = oGdPicturePDF.SaveToStream(oFileStream)
            MessageBox.Show("The SaveToStream() method has followed with the status: " + status.ToString(), "Example: SaveToStream")
        End If
        oFileStream.Dispose()
    End If
    oGdPicturePDF.Dispose()
    GdPicturePDF oGdPicturePDF = new GdPicturePDF();
    GdPictureStatus status = oGdPicturePDF.LoadFromFile("test.pdf", false);
    if (status == GdPictureStatus.OK)
    {
        System.IO.FileStream oFileStream = new System.IO.FileStream("test_SaveToStream.pdf", System.IO.FileMode.Create);
        oGdPicturePDF.EnableCompression(true);
        if (oGdPicturePDF.GetStat() == GdPictureStatus.OK)
        {
            status = oGdPicturePDF.SaveToStream(oFileStream);
            MessageBox.Show("The SaveToStream() method has followed with the status: " + status.ToString(), "Example: SaveToStream");
        }
        oFileStream.Dispose();
    }
    oGdPicturePDF.Dispose();
    See Also