ImageGear for C and C++ on Linux v18.8 - Updated
LPFNIG_BATCH_BEFORE_OPEN
API Reference Guide > Core Component API Reference > Core Component Callback Functions Reference > LPFNIG_BATCH_BEFORE_OPEN

LPFNIG_BATCH_BEFORE_OPEN is called before a file is opened, allowing you to get the file name and correct some settings.

Declaration:

 
Copy Code
typedef AT_BOOL (LPACCUAPI LPFNIG_BATCH_BEFORE_OPEN)(
        LPVOID lpPrivate, 
        const LPSTR lpszFileName
);

Arguments:

Name Type Description
lpPrivate LPVOID A far pointer to private data area.
lpszFileName const LPSTR The name of file to be opened.

Return Value:

Reserved (must always be TRUE).

Supported Raster Image Formats:

This function does not process image pixels.

Example:

 
Copy Code
//Dll
//User's BatchBeforeOpen CB
AT_BOOL MyBatchBeforeOpen(
   LPVOID         lpPrivate,     /* Private data passed in*/
                const LPSTR    lpszFileName   /* File name to be open*/
   )
{
// Set PDF control name if the file is PDF
                AT_MODE nFileType;
                IG_info_get(lpszFileName, 1, NULL, nFileType, NULL, NULL);
                if(nFileType == IG_FORMAT_PDF)
                {
                        IG_fltr_ctrl_set(IG_FORMAT_PDF, "FILENAME", (LPVOID) lpszFileName,
sizeof(lpszFileName));
                }
                return TRUE;
}
// Register BatchBeforeOpen CB
IG_batch_CB_register(MyBatchBeforeOpen, IG_BATCHCB_BEFORE_OPEN, NULL);

Remarks:

For example, some multimedia formats and PDF file names require you to get the file name before page conversion.