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

This function allows you to print an array of images and specify the number of images per width (row) and per height (column) of the page.

Declaration:

 
Copy Code
AT_ERRCOUNT  ACCUAPI  IG_dspl_document_print(
        [IN] const LPHIGEAR lphIGear,
        [IN] UINT nImageCount,
        [IN] DWORD dwGrpID,
        [IN] HDC hDC,
        [IN] UINT nImagesPerWidth,
        [IN] UINT nImagesPerHeight,
        [IN] DOUBLE dblXSpace,
        [IN] DOUBLE dblYSpace,
        [IN] BOOL bDirectToDriver,
        [IN] LPFNIG_IMAGESPOOLED lpfnImageSpooled,
        [IN] LPVOID lpPrivateData
);

Arguments:

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 options for printing for each image.
hDC HDC Handle of printer device context on which to draw images.
nImagesPerWidth UINT Number of images that should be placed in row.
nImagesPerHeight UINT Number of images that should be placed in column.
dblXSpace DOUBLE Horizontal destination between images in row in page's width relative coordinates. This means the actual destination in device coordinates is calculated as: xSpace = PageWidth*dblXSpace.
dblYSpace DOUBLE Vertical destination between images in column in page's height relative coordinates. This means the actual destination in device coordinates is calculated as: ySpace = PageHeight*dblYSpace.
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 lpfnImageSpooled callback function in 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++.

Sample:

Display, Print

Example:

 
Copy Code
HIGEAR lphIGear[10]; /* array of HIGEAR handles of images  */ 
DWORD nGrpID;       /* display group identifier  */
BOOL bDirect;  /* direct to driver flag  */
PRINTDLG pd;      /* print dialog structure  */
INT nPrivateInfo;
 ...
case ID_FILE_PRINT:
         ... 
        if( PrintDlg(&pd) )
        {
 ...
IG_dspl_document_print( lphIGear, 10, nGrpID, pd.hDC, 2, 3, 0.05, 0.05, 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 */
}
 ...

Remarks:

lpfnImageSpooled function will be called after each image is printed and can use the lpPrivateDataparameter 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.