GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / TiffSaveMultiPageToFile Method / TiffSaveMultiPageToFile(Int32,String,TiffCompression) Method
A unique image identifier of the GdPicture image representing the editable multipage TIFF image to be saved.
The file path where the specified image will be saved. Be aware, that if the destination file path is the same as the source file path, the method will fail unless the image has not been loaded in memory.
A member of the TiffCompression enumeration. The resulting TIFF compression scheme to be used.

Please note that if you apply the JPEG compression, the quality factor used by default is 90. You can use the overloaded TiffSaveMultiPageToFile(Int32,String,TiffCompression,Int32) method to set your preferred value for the JpegQuality parameter.

Example





In This Topic
TiffSaveMultiPageToFile(Int32,String,TiffCompression) Method
In This Topic
Saves a GdPicture image representing the editable multipage TIFF image to a multipage TIFF file acording to what you have specified.

This method only handles editable multipage TIFF images; otherwise it will fail.

Syntax
'Declaration
 
Public Overloads Function TiffSaveMultiPageToFile( _
   ByVal ImageID As Integer, _
   ByVal FilePath As String, _
   ByVal Compression As TiffCompression _
) As GdPictureStatus
public GdPictureStatus TiffSaveMultiPageToFile( 
   int ImageID,
   string FilePath,
   TiffCompression Compression
)
public function TiffSaveMultiPageToFile( 
    ImageID: Integer;
    FilePath: String;
    Compression: TiffCompression
): GdPictureStatus; 
public function TiffSaveMultiPageToFile( 
   ImageID : int,
   FilePath : String,
   Compression : TiffCompression
) : GdPictureStatus;
public: GdPictureStatus TiffSaveMultiPageToFile( 
   int ImageID,
   string* FilePath,
   TiffCompression Compression
) 
public:
GdPictureStatus TiffSaveMultiPageToFile( 
   int ImageID,
   String^ FilePath,
   TiffCompression Compression
) 

Parameters

ImageID
A unique image identifier of the GdPicture image representing the editable multipage TIFF image to be saved.
FilePath
The file path where the specified image will be saved. Be aware, that if the destination file path is the same as the source file path, the method will fail unless the image has not been loaded in memory.
Compression
A member of the TiffCompression enumeration. The resulting TIFF compression scheme to be used.

Please note that if you apply the JPEG compression, the quality factor used by default is 90. You can use the overloaded TiffSaveMultiPageToFile(Int32,String,TiffCompression,Int32) method to set your preferred value for the JpegQuality parameter.

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
Be aware that this method only handles editable multipage TIFF images. You can use the TiffIsEditableMultiPage method to check if a required image is an editable multipage TIFF image.

Likewise, if the destination file is the same as the source file, the method will fail, unless the image has not been loaded in memory applying the LoadInMemory parameter in the overloaded TiffCreateMultiPageFromFile(String,Boolean) method.

Just to inform you, that if you are applying CCITT3 or CCITT4 compression scheme, the image you want to save can only have 1bpp pages included, otherwise the LZW compression scheme is used.

Example
Saving pages to a multipage tiff.
Swapping two pages in a multipage tiff document.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // LoadInMemory parameter is set to true in order to be able to update the input file.
    int imageID = gdpictureImaging.TiffCreateMultiPageFromFile("multipage.tif", true);
    gdpictureImaging.TiffSwapPages(imageID, 1, 2);
    gdpictureImaging.TiffSaveMultiPageToFile(imageID, "multipage.tif", TiffCompression.TiffCompressionAUTO);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Saving the pages of a dicom document to a multipage tiff.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int dcmImageID = gdpictureImaging.CreateGdPictureImageFromFile("image.dcm", false);
 
    // Create a tiff with the first page.
    int tiffImageID = gdpictureImaging.TiffCreateMultiPageFromGdPictureImage(dcmImageID);
 
    // Add the remaining pages as additional pages to the tif.
    int pageCount = gdpictureImaging.DicomGetPageCount(dcmImageID);
    for (int pageNo = 2; pageNo <= pageCount; pageNo++)
    {
        gdpictureImaging.DicomSelectPage(dcmImageID, pageNo);
        gdpictureImaging.TiffAppendPageFromGdPictureImage(tiffImageID, dcmImageID);
    }
 
    gdpictureImaging.TiffSaveMultiPageToFile(tiffImageID, "image.tif", TiffCompression.TiffCompressionAUTO);
    gdpictureImaging.TiffCloseMultiPageFile(tiffImageID);
 
    gdpictureImaging.ReleaseGdPictureImage(tiffImageID);
    gdpictureImaging.ReleaseGdPictureImage(dcmImageID);
}
See Also