ImageGear for C and C++ on Windows v20.0 - Updated
IG_PDF_doc_get_page
API Reference Guide > PDF Component API Reference > PDF Component Objects Reference > General Objects > HIG_PDF_DOC > IG_PDF_doc_get_page

This function obtains a handle to a PDF page.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_PDF_doc_get_page(
        HIG_PDF_DOC hDoc,
        UINT nPageNumber,
        LPHIG_PDF_PAGE lphPage
);

Arguments:

Name Type Description
hDoc HIG_PDF_DOC The document from which the page is obtained.
nPageNumber UINT The index of the page to obtain. The first page is 0.
lphPage LPHIG_PDF_PAGE A pointer to memory that is populated with an HIG_PDF_PAGE handle for the selected page.

Return Value:

The number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.

Supported Raster Image Formats:

This function does not process image pixels.

Remarks:

Applications that obtain an HIG_PDF_PAGE from IG_PDF_doc_get_page are required to invoke this function to decrement that PDF page's reference count and release the HIG_PDF_PAGE instance. This ensures that the PDF document can successfully close.

For example:

 
Copy Code
const AT_INT FIRST_PAGE = 0 ; 
HMIGEAR higDoc = 0 ;
HIG_PDF_DOC hPdfDoc = 0 ;
HIG_PDF_PAGE hPdfPage = 0 ;
UINT annotation_count = (UINT)-1 ;
// Recover number of annotations on first PDF page
IG_mpi_create( &higDoc , 0 ) ;
IG_mpi_file_open( "sample.pdf" , higDoc, IG_FORMAT_PDF , IG_MP_OPENMODE_READWRITE ) ;
IG_mpi_info_get( higDoc, IG_MP_DOCUMENT, &hPdfDoc, sizeof( hPdfDoc ) ) ;
IG_PDF_doc_get_page( hPdfDoc, FIRST_PAGE, &hPdfPage ) ;
IG_PDF_page_get_annotation_count( hPdfPage , &annotation_count ) ;
IG_PDF_doc_page_release( hPdfPage ) ;
IG_mpi_delete( higDoc ) ;
Is this page helpful?
Yes No
Thanks for your feedback.