SaveToStream(Stream) Method
In This Topic
Saves the currently loaded PDF document to an instantiated Stream object according to what you have specified.
Syntax
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.
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();
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