ImageGear for C and C++ on Windows v19.10 - Updated
IG_mpf_page_load
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Multi Page Image File Functions > IG_mpf_page_load

If a multi-page image is associated with an external file, it loads and stores the specified number of pages from the external file into a multi-page image.

Declaration:

 
Copy Code
AT_ERRCOUNT IG_mpf_page_load( 
        [IN] HMIGEAR hMIGear, 
        [IN] UINT nStartPage, 
        [IN] UINT nCount
);

Arguments:

Name Type Description
hMIGear HMIGEAR The handle of the allocated multi-page image.
nStartPage UINT The first page to be loaded.
nCount UINT The total number of pages to be loaded.

Return Value:

Returns 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:

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

Sample:

MFC Multipage

Example:

 
Copy Code
HMIGEAR hMIGear;     /* handle to multi-page image */
AT_ERRCOUNT nErrCount = IGE_SUCCESS; /* will hold returned error count */
UINT nPageCount = 0; /* number of pages that should get from multi-page image */
UINT i;
HIGEAR hIGear;     /* handle of an image */
 ...
/* initialize multi-page image and assign it with external file */
nErrCount = IG_mpf_page_count_get( hMIGear, &nPageCount );
for ( i = 0; i < nPageCount; i++ )
        if (!nErrCount)
        if ( !IG_mpi_page_is_valid(hMIGear, i) && (!nErrCount) )
        nErrCount = IG_mpf_page_load( hMIGear, i, 1 );  

Remarks:

To access the loaded pages, use the IG_mpi_page_get() function.

If the multi-page image is not associated with an external file, or a failure to load a page occurs, then an error is set. This function loads each Nth page from a file into the correspondent Nth page into the multi-page image. Previous page values are not deleted with function IG_image_delete(). If necessary, the number of pages is expanded to fit all loaded pages.

The access to the same PDF document from multiple threads is not permitted because the multiple threads cannot share Adobe PDF Library data types. PDF docs created/opened in the main thread can be only used from the main thread.