This function allows you to print an array of images and customize each image's layout on the page.
Declaration:
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 ); |
Arguments:
lphIGear | Array of ImageGear image handles to print. |
nImageCount | Number of elements in lphIGear array. |
dwGrpID | Identifier of group from which to get the options for printing for each image. |
hDC | Handle of printer device context on which to draw the images. |
nImagesPerPage | Number of images that should be placed in a single page. |
lpImagesLayout | 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 | 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 | Callback function that will be called after each image is printed. |
lpPrivateData | 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 Professional.
Sample:
None
Example:
Copy Code | |
---|---|
HIGEAR lphIGear[10]; /* array of HIGEAR handles of images */ DWORD nGrpID; /* display group identifier */ BOOL bDirect; /* direct to driver flag */ AT_DRECTANGLE Layout[2]; /* array describes image layout on single page */ PRINTDLG pd; /* print dialog structure */ INT nPrivateInfo; ... case ID_FILE_PRINT: ... 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 */ } |
Remarks:
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. |