IGR_Get_Page_Count¶
IGR_Get_Page_Count returns the number of pages generated for an open document. This method only works on functions opened with IGR_FORMAT_IMAGE.
Prototype¶
IGR_LONG IGR_Get_Page_Count(
IGR_LONG DocHandle,
IGR_LONG* PageCount,
Error_Control_Block* Error);
Parameters¶
DocHandle: Unicode string (UCS2)
Handle to a document, opened by a call to IGR_Open_File, IGR_Open_File_Ex, IGR_Open_Stream or IGR_Open_Stream_Ex.
PageCount: Pointer to IGR_LONG
Set to the number of pages contained within the document.
Error: Pointer to Error_Control_Block
Returns error details if the call fails.
Return value¶
Success: IGR_LONG
Returns IGR_OK.
Failure: IGR_LONG
Returns one of the possible IGR_E error codes.
Sample code¶
Error_Control_Block ISYSError;
IGR_LONG Capabilities, DocType, DocHandle, PageCount;
HPAGE PageHandle;
IGR_LONG RC = IGR_Open_Stream(pStream, IGR_FORMAT_IMAGE, &Capabilities, &DocType, &DocHandle, &ISYSError);
if (RC == IGR_OK)
{
if (IGR_Get_Page_Count(DocHandle, &PageCount, &ISYSError) == IGR_OK)
{
for (IGR_LONG PageIndex = 0; PageIndex < PageCount; PageIndex++)
{
if (IGR_Open_Page(DocHandle, PageIndex, &PageHandle, &ISYSError) == IGR_OK)
{
// Process Page Element
IGR_Close_Page(PageHandle, &ISYSError);
}
}
}
IGR_Close_File(DocHandle, &ISYSError);
}