From Tracker Software PDF SDK
The method retrieves the color count for the page or rectangular section.
HRESULT CountColorsEx([in] RECT* stRect, [out, retval] ULONG* nCount);
- [in] Pointer to RECT structure which defines the rectangular area where the function should be applied. If this parameter is NULL, the entire page will be processed.
- [out, retval] Pointer to the variable which will contain the color count.
Returns S_OK if operation was successful or error code in other cases.