GdPicture.NET Reference Guide
SaveDocumentToTIFF(Stream,TiffCompression) Method
Example 





GdPicture14.WPF Namespace > GdViewer Class > SaveDocumentToTIFF Method : SaveDocumentToTIFF(Stream,TiffCompression) Method
A Stream object where the resulting TIFF file 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.
A member of the TiffCompression enumeration. Specifies the compression method to be used to compress the resulting TIFF file.
Saves the document displayed in the viewer in TIFF format to an instantiated Stream object according to what you have specified. The document is saved with full GdPicture/XMP annotation support, therefore this method requires the GdPicture/XMP Annotations Plugin for use.

Please consider using the BurnAnnotationsToPage(Boolean) method before saving, if you expect, that your annotations will be included in the document content.

The SavingProgress event is raised after each successfully saved page.

Syntax
'Declaration
 
Public Overloads Function SaveDocumentToTIFF( _
   ByVal Stream As Stream, _
   ByVal Compression As TiffCompression _
) As GdPictureStatus
public GdPictureStatus SaveDocumentToTIFF( 
   Stream Stream,
   TiffCompression Compression
)
public function SaveDocumentToTIFF( 
    Stream: Stream;
    Compression: TiffCompression
): GdPictureStatus; 
public function SaveDocumentToTIFF( 
   Stream : Stream,
   Compression : TiffCompression
) : GdPictureStatus;
public: GdPictureStatus SaveDocumentToTIFF( 
   Stream* Stream,
   TiffCompression Compression
) 
public:
GdPictureStatus SaveDocumentToTIFF( 
   Stream^ Stream,
   TiffCompression Compression
) 

Parameters

Stream
A Stream object where the resulting TIFF file 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.
Compression
A member of the TiffCompression enumeration. Specifies the compression method to be used to compress the resulting TIFF file.

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
Please note that the GdPicture/XMP Annotations Plugin is required to successfully apply this method and utilize the full GdPicture/XMP annotation support.

Just to remind you that if you want to permanently incorporate the annotations to be part of the document content, you need to use the BurnAnnotationsToPage(Boolean) method before saving the file.

The SavingProgress event is raised when processing documents using this method.

The output stream should be open for writing and should be closed/disposed by the user as well.

Example
How to save the file displayed in the viewer to the TIFF image using the stream.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
    'Annotate your document.
    If GdViewer1.BurnAnnotationsToPage(True) = GdPictureStatus.OK Then
        Dim oFileStream As System.IO.FileStream = New System.IO.FileStream("myimage.tif", System.IO.FileMode.Create)
        If GdViewer1.SaveDocumentToTIFF(oFileStream, TiffCompression.TiffCompressionAUTO) = GdPictureStatus.OK Then
            MessageBox.Show("Done!", "GdViewer.SaveDocumentToTIFF")
        Else
            MessageBox.Show("The file can't be saved. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToTIFF")
        End If
        oFileStream.Dispose()
    Else
        MessageBox.Show("Annotations can't be burned. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToTIFF")
    End If
Else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToTIFF")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
    //Annotate your document.
    if (GdViewer1.BurnAnnotationsToPage(true) == GdPictureStatus.OK)
    {
        System.IO.FileStream oFileStream = new System.IO.FileStream("myimage.tif", System.IO.FileMode.Create);
        if (GdViewer1.SaveDocumentToTIFF(oFileStream, TiffCompression.TiffCompressionAUTO) == GdPictureStatus.OK)
            MessageBox.Show("Done!", "GdViewer.SaveDocumentToTIFF");
        else
            MessageBox.Show("The file can't be saved. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToTIFF");
        oFileStream.Dispose();
    }
    else
        MessageBox.Show("Annotations can't be burned. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToTIFF");
}
else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToTIFF");
See Also

Reference

GdViewer Class
GdViewer Members
Overload List
SaveDocumentToJPEG(Stream,Int32) Method
SaveDocumentToPDF(Stream) Method
SavingProgress Event
BurnAnnotationsToPage(Boolean) Method