ImageGear for C and C++ on Linux v20.0 - Updated
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Display Functions > IG_dspl_document_print_custom

This function allows you to print an array of images and customize each image's layout on the page.


Copy Code
AT_ERRCOUNT    ACCUAPI    IG_dspl_document_print_custom(
        [IN] const LPHIGEAR lphIGear,
        [IN] UINT nImageCount,
        [IN] DWORD dwGrpID,
        [IN] HDC hDC,
        [IN] UINT nImagesPerPage,
        [IN] const LPAT_DRECTANGLE lpImagesLayout,
        [IN] BOOL bDirectToDriver,
        [IN] LPFNIG_IMAGESPOOLED lpfnImageSpooled,
        [IN] LPVOID lpPrivateData


Name Type Description
lphIGear const LPHIGEAR Array of ImageGear image handles to print.
nImageCount UINT Number of elements in lphIGear array.
dwGrpID DWORD Identifier of group from which to get the options for printing for each image.
hDC HDC Handle of printer device context on which to draw the images.
nImagesPerPage UINT Number of images that should be placed in a single page.
lpImagesLayout const LPAT_DRECTANGLE Array of length nImagesPerPage of rectangles where an i-th rectangle specifies how the i-th image of this page is located on that page. Each rectangle is calculated in page-relative units, and as the actual page resolutions are obtained, it translates the rectangles into real coordinates and assigns values to ClipRect according to the following rules: ClipRect.x = lpLayout[i].x*nPageWidth ClipRect.y = lpLayout[i].y*nPageHeight ClipRect.width = lpLayout[i].width*nPageWidth ClipRect.height = lpLayout[i].height*nPageHeight
bDirectToDriver BOOL If TRUE, then ImageGear does not perform image scaling but uses the operating system's and driver's capabilities for this. If FALSE then ImageGear performs the scaling.
lpfnImageSpooled LPFNIG_IMAGESPOOLED Callback function that will be called after each image is printed.
lpPrivateData LPVOID Private data that will be passed to the lpfnImageSpooled callback function in the first parameter.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

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


Copy Code
HIGEAR           lphIGear[10];  /* array of HIGEAR handles of images */ 
DWORD           nGrpID;        /* display group identifier  */
BOOL            bDirect;        /* direct to driver flag  */
                Layout[2];   /* array describes image layout on single page */
PRINTDLG                pd;         /* print dialog structure   */
INT             nPrivateInfo;
        if( PrintDlg(&pd) )
/* place one page at the left top of the page              */
Layout[0].x = 0.01; Layout[0].y = 0.01;
Layout[0].width = 0.48; Layout[0].height = 0.48;
/* and second page at the right bottom                     */
Layout[1].x = 0.51; Layout[1].y = 0.51;
Layout[1].width = 0.48; Layout[1].height = 0.48;
IG_dspl_document_print_custom( lphIGear, 10, nGrpID, pd.hDC, 2, Layout, bDirect,
ImageSpooled, &nPrivateInfo );
        }        ...
        break; ...
BOOL    ACCUAPI  ImageSpooled( 
        LPVOID   lpPrivate,      /* Private data passed in   */
        UINT     nImageNumber, /* Current image being spooled (1 based) */
        UINT     nPageNumber  /* Current page number being spooled  */
{        ...
        return  TRUE;   /* return FALSE to cancel printing  */


lpfnImageSpooled function will be called after each image is printed and you can use the lpPrivateData parameter as private data storage. bDirectToDriver parameter allows you to perform image scaling inside of ImageGear or leave this task to the printer driver and operating system. Usually, direct to driver printing (bDirectToDriver=TRUE) results in smaller output size and it works faster, but not using it produces better quality and allows you to use such ImageGear capabilities as anti-aliasing during printing.

Special predefined option group IG_GRP_DEFAULT_PRINT can be used to print an image with the most common parameters.

For an overview on printing, see the section Printing Images. For more information on option groups, see the section Viewing.

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