ImageGear for C and C++ on Windows v20.0 - Updated
IG_mpf_page_save
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Multi Page Image File Functions > IG_mpf_page_save

If the multi-page image is associated with an external file then this function saves the specified pages from multi-page image to the external file.

Declaration:

 
Copy Code
AT_ERRCOUNT IG_mpf_page_save( 
        [IN] HMIGEAR hMIGear, 
        [IN] UINT nStartPage, 
        [IN] UINT nCount,
        [IN] AT_MODE nCompression,
        [IN] AT_MODE nSaveMode
);

Arguments:

Name Type Description
hMIGear HMIGEAR The handle of the multi-page image.
nStartPage UINT First page to save.
nCount UINT Total number of pages to save.
nCompression AT_MODE Compression method to be used when saving the pages.
nSaveMode AT_MODE The methods for saving the pages can be:
  • IG_MPF_SAVE_INSERT
  • IG_MPF_SAVE_REPLACE

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 );
if ( !nErrCount && (nPageCount > 0) )
IG_mpf_page_save( hMIGear, 0, 1, IG_COMPRESSION_NONE, IG_MPF_SAVE_INSERT );

Remarks:

If nSaveMode is IG_MPF_SAVE_INSERT, then the specified nCount number of pages are inserted, starting with nStartPage index, and all previous pages are shifted to a higher page number. If nSaveMode is IG_MPF_SAVE_REPLACE, then the function replaces the specified nCount number of pages, starting with the nStartPage index. If a page is NULL in the multi-page image, it is skipped and not saved.

This function takes each specified Nth page from a multi-page image and saves it as the Nth page into an external file. If the image is not associated with an external file, then it returns an error.

Not all format filters support IG_MPF_SAVE_REPLACE mode. Use the IG_fltr_info_get() function to obtain information about the supported features for specific format filters.

Is this page helpful?
Yes No
Thanks for your feedback.