GdPicture.NET.14
GdPicture14 Namespace / GdPictureDocumentConverter Class / SaveAsTIFF Method / SaveAsTIFF(Stream,TiffCompression) Method
A stream object where the current document is saved to as a TIFF image. This output stream must be initialized before it can be sent into this method and it should stay open for subsequent use.

If the output stream is not opened for both reading and writing, the method will fail returning the GdPictureStatus.InvalidParameter status.

A member of the TiffCompression enumeration. Specifies the compression method to be used to compress the resulting TIFF image.
Example





In This Topic
SaveAsTIFF(Stream,TiffCompression) Method
In This Topic
This method converts and saves the currently loaded document to an instantiated stream object according to what you have specified. The output format is TIFF.

The resulting image will be compressed using the compression method according to your preference.

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

Parameters

Stream
A stream object where the current document is saved to as a TIFF image. This output stream must be initialized before it can be sent into this method and it should stay open for subsequent use.

If the output stream is not opened for both reading and writing, the method will fail returning the GdPictureStatus.InvalidParameter status.

TiffCompression
A member of the TiffCompression enumeration. Specifies the compression method to be used to compress the resulting TIFF image.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
Remarks
Keep noted that the output stream should be open for both reading and writing and should be closed/disposed by the user as well.

The currently selected page remains selected after saving.

This method requires the Image Conversion component to run.

Example
Converting and saving a PDF document to a TIFF image file using a stream.
Using gdpictureDocumentConverter As New GdPictureDocumentConverter()
    Dim status As GdPictureStatus = gdpictureDocumentConverter.LoadFromFile("drawing.pdf", GdPicture14.DocumentFormat.DocumentFormatPDF)
    If status = GdPictureStatus.OK Then
        Dim oFileStream As New System.IO.FileStream("drawing_stream.tiff", System.IO.FileMode.Create)
        status = gdpictureDocumentConverter.SaveAsTIFF(oFileStream, TiffCompression.TiffCompressionAUTO)
        If status = GdPictureStatus.OK Then
            MessageBox.Show("The file has been saved successfully.", "GdPicture")
        Else
            MessageBox.Show("The file has failed to save. Status: " + status.ToString(), "GdPicture")
        End If
        oFileStream.Dispose()
    Else
        MessageBox.Show("The file has failed to load. Status: " + status.ToString(), "GdPicture")
    End If
End Using
using (GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter())
{
    GdPictureStatus status = gdpictureDocumentConverter.LoadFromFile("drawing.pdf", GdPicture14.DocumentFormat.DocumentFormatPDF);
    if (status == GdPictureStatus.OK)
    {
        System.IO.FileStream oFileStream = new System.IO.FileStream("drawing_stream.tiff", System.IO.FileMode.Create);
        status = gdpictureDocumentConverter.SaveAsTIFF(oFileStream, TiffCompression.TiffCompressionAUTO);
        if (status == GdPictureStatus.OK)
        {
            MessageBox.Show("The file has been saved successfully.", "GdPicture");
        }
        else
        {
            MessageBox.Show("The file has failed to save. Status: " + status.ToString(), "GdPicture");
        }
        oFileStream.Dispose();
    }
    else
    {
        MessageBox.Show("The file has failed to load. Status: " + status.ToString(), "GdPicture");
    }
}
See Also