GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / SaveToStreamInc 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
SaveToStreamInc Method (GdPicturePDF)
In This Topic
Saves the currently loaded PDF document to an instantiated Stream object using incremental updates. This incremental saving feature (see PDF Reference for Incremental updates) executes very quick save and ensures the document content persistence, but it also produces bigger file than the standard save process. We suggest to use this method only if you perform small modifications on large documents.

The content of a PDF file can be updated incrementally without rewriting the entire file. Changes are appended to the end of the file, leaving its original content intact. The main advantage to updating a file in this way is that small changes to a large document can be saved quickly (see PDF Reference, Section "Incremental updates").

Syntax
'Declaration
 
Public Function SaveToStreamInc( _
   ByVal Stream As Stream _
) As GdPictureStatus
public GdPictureStatus SaveToStreamInc( 
   Stream Stream
)
public function SaveToStreamInc( 
    Stream: Stream
): GdPictureStatus; 
public function SaveToStreamInc( 
   Stream : Stream
) : GdPictureStatus;
public: GdPictureStatus SaveToStreamInc( 
   Stream* Stream
) 
public:
GdPictureStatus SaveToStreamInc( 
   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
This method is only allowed for use with non-encrypted documents.

This method requires the PDF Processing component to run.

Example
How to add a cloned page to the PDF document and save the file to a stream using incremental saving feature. Incremental updates (see also PDF Reference) help to reduce memory usage and dramatically increase performance during the merging process.
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
    If gdpicturePDF.SelectPage(1) <> GdPictureStatus.OK Then
        GoTo [error]
    End If
    If gdpicturePDF.DuplicatePage(1) <> GdPictureStatus.OK Then
        GoTo [error]
    End If
    Dim oFileStream As New System.IO.FileStream("test_SaveIncToStream.pdf", System.IO.FileMode.Create)
    status = gdpicturePDF.SaveToStreamInc(oFileStream)
    oFileStream.Close()
    MessageBox.Show("The SaveToStreamInc() method has failed with the status: " + status.ToString(), "Example: SaveToStreamInc")
End If
[error]:
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
    if (gdpicturePDF.SelectPage(1) != GdPictureStatus.OK) goto error;
    if (gdpicturePDF.DuplicatePage(1) != GdPictureStatus.OK) goto error;
    System.IO.FileStream oFileStream = new System.IO.FileStream("test_SaveIncToStream.pdf", System.IO.FileMode.Create);
    status = gdpicturePDF.SaveToStreamInc(oFileStream);
    oFileStream.Close();
    MessageBox.Show("The SaveToStreamInc() method has failed with the status: " + status.ToString(), "Example: SaveToStreamInc");
}
error:
gdpicturePDF.Dispose();
See Also