ImageGear Professional v18 for Mac
IG_dspl_image_print

This function draws an image onto the printer device context.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_dspl_image_print( 
        [IN] HIGEAR hIGear,
        [IN] DWORD dwGrpID,
        [IN] HDC hDC,
        [IN] BOOL bDirectToDriver
);

Arguments:

Name Type Description
hIGear HIGEAR ImageGear handle of image.
DwGrpID DWORD Identifier of group from which to get image options.
hDC HDC Handle of device context on which to draw the image.
bDirectToDriver BOOL If TRUE then ImageGear does not perform image scaling but use the operating system's and driver's capabilities for this. If FALSE then ImageGear performs the scaling.

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.

Example:

 
Copy Code
HIGEAR hIGear; /* HIGEAR handle of image
*/
DWORD nGrpID; /* display group identifier
*/
BOOL bDirect ; /* direct to driver flag
*/
- (void)drawRect:(NSRect)dirtyRect
{
    
    if(IG_image_is_valid(hIGear))
    {
        // Get device context
        CGContextRef myContext = [[NSGraphicsContext currentContext] graphicsPort];
        if([NSGraphicsContext currentContextDrawingToScreen])
            // Draw the image to the screen
            IG_dspl_image_draw(hIGear, 0, (__bridge HWND)self, (HDC)myContext, NULL);
        else
        {
            // Set printing resolution
            AT_INT printRes = 200;
            IG_gctrl_item_set( "PRINT.RESOLUTION", AM_TID_INT, &printRes, sizeof(AT_INT), NULL );
            // Print the image
            IG_dspl_image_print(hIGear, 0, (HDC)myContext, bDirect);
        }
    }
}

Remarks:

Print resolution is controlled with “PRINT.RESOLUTION” Global Control Parameter. bDirectToDriver parameter allows you to either 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 works faster, but not using it produces better quality and allows you to use ImageGear capabilities such 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.

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback