A unique image identifier of the GdPicture image representing the multipage TIFF image.
Example





In This Topic
GdPicture14 Namespace / GdPictureImaging Class / TiffGetPageCount Method

TiffGetPageCount Method (GdPictureImaging)

In This Topic
Returns the number of pages in the specified multipage TIFF image represented by its unique image identifier.

This method only handles multipage TIFF images, both editable or opened as read-only.

Syntax
'Declaration
 
Public Function TiffGetPageCount( _
   ByVal ImageID As Integer _
) As Integer
public int TiffGetPageCount( 
   int ImageID
)
public function TiffGetPageCount( 
    ImageID: Integer
): Integer; 
public function TiffGetPageCount( 
   ImageID : int
) : int;
public: int TiffGetPageCount( 
   int ImageID
) 
public:
int TiffGetPageCount( 
   int ImageID
) 

Parameters

ImageID
A unique image identifier of the GdPicture image representing the multipage TIFF image.

Return Value

The number of pages in the specified multipage TIFF image. The GetStat method can be subsequently used to determine if this method has been successful.
Remarks
It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

Be aware that this method only supports multipage TIFF images, both editable or opened as read-only. If the specified image is not a multipage image, this method will fail.

Example
Deleting pages of a multipage tiff document.
Deleting the last page of 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);
    int pageCount = gdpictureImaging.TiffGetPageCount(imageID);
    gdpictureImaging.TiffDeletePage(imageID, pageCount);
    gdpictureImaging.TiffSaveMultiPageToFile(imageID, "multipage.tif", TiffCompression.TiffCompressionAUTO);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Removing the blank pages from a 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);
    int pageCount = gdpictureImaging.TiffGetPageCount(imageID);
    int pageNo = 1;
    while (pageNo <= pageCount)
    {
        gdpictureImaging.TiffSelectPage(imageID, pageNo);
        if (gdpictureImaging.IsBlank(imageID))
        {
            gdpictureImaging.TiffDeletePage(imageID, pageNo);
            pageCount--;
        }
        else
        {
            pageNo++;
        }
    }
    gdpictureImaging.TiffSaveMultiPageToFile(imageID, "multipage.tif", TiffCompression.TiffCompressionAUTO);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also