ImageGear for C and C++ on Windows v19.3 - Updated
IG_fltr_pagecount_file_format_W
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Filter Functions > IG_fltr_pagecount_file_format_W

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

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_pagecount_file_format_W(
   AT_MODE nFormat,
   const LPAT_WCHAR lpwszFileName,
   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.
lpwszFileName const LPAT_WCHAR Path and name of the file for which to get the page count, specified as a wide string (UTF-16). 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++.

Sample:

GUI Windows

Example:

 
Copy Code
UINT nPageCount;
AT_ERRCOUNT nErrCount = IG_fltr_pagecount_file_format_W(IG_FORMAT_TIF, L"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.

This function may work slower on PDF and PostScript images, compared to its ANSI analog IG_fltr_pagecount_file_format.