GdPicture.NET.14
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 gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
    Dim oFileStream As New System.IO.FileStream("test_SaveToStream.pdf", System.IO.FileMode.Create)
    gdpicturePDF.EnableCompression(True)
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        status = gdpicturePDF.SaveToStream(oFileStream)
        MessageBox.Show("The SaveToStream() method has followed with the status: " + status.ToString(), "Example: SaveToStream")
    End If
    oFileStream.Dispose()
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
    System.IO.FileStream oFileStream = new System.IO.FileStream("test_SaveToStream.pdf", System.IO.FileMode.Create);
    gdpicturePDF.EnableCompression(true);
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        status = gdpicturePDF.SaveToStream(oFileStream);
        MessageBox.Show("The SaveToStream() method has followed with the status: " + status.ToString(), "Example: SaveToStream");
    }
    oFileStream.Dispose();
}
gdpicturePDF.Dispose();
See Also