ImageGear for C and C++ on Linux v18.8 - Updated
IG_fltr_pagecount_file_format
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Filter Functions > IG_fltr_pagecount_file_format

This function obtains the number of pages in a multi-page file.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_pagecount_file_format(
   AT_MODE nFormat,
   const LPSTR lpszFileName,
   LPUINT lpPageCount
);

Arguments:

Name Type Description
nFormat AT_MODE A constant indicating the file format of the input file. See enumIGFormats for possible values. Set to IG_FORMAT_UNKNOWN to let ImageGear detect the file format.
lpszFileName const LPSTR Path and name of the file to get the page count for. The path can be absolute or relative.
lpPageCount LPUINT Number of pages returned by this function.

Return Value:

Returns 0 if successful. Otherwise, returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Example:

 
Copy Code
UINT nPageCount;
AT_ERRCOUNT nErrCount = IG_fltr_pagecount_file_format(IG_FORMAT_TIF, "picture.tif", &nPageCount);

Remarks:

If nFormat = IG_FORMAT_UNKNOWN then ImageGear attempts to detect the file format automatically, and then detects the page count. Otherwise, ImageGear skips the file format detection and counts image page using the specified format filter.