PrintDIBPageExt3 Method

 

 

Description

This function prints a page of a single or multi-page document. Printing will be done according to the settings in the dwFlags parameter and the printer settings in the pDevMode parameter. Specifying the settings in the PrintDIBPageExt3 function allows for setting the scaling options for each page separately.

Syntax

RetVal = [BIPrint.] PrintDIBPageExt3 hDib, DPIX, DPIY, Page, Flags, pDevMode

Parameters

hDib

LONGLONG

Handle to the image.

 

DPIX

Integer

Horizontal image resolution in DPI. If DPIX or DPIY is 0 the resolution of the DIB is used.

 

DPIY

Integer

Vertical image resolution in DPI. If DPIX or DPIY is 0 the resolution of the DIB is used.

 

Page

Integer

Current page number.

 

Flags

Integer

Flags to override the scaling settings specified in the PrepareToPrint function. Overriding the settings allows for setting the scaling for each page separately. The usable values are the following:

·         BI_PRINT_SCALE_IMAGE (0) – Scale the image proportionally to the page.

·         BI_PRINT_STRETCH_IMAGE (1) – Stretch the image to the page ignoring proportions.

·         BI_PRINT_USE_IMAGE_DPI (2) – Use the image DPI from the lpptDPI parameter or from the DIB to draw the image in the original size.

·         BI_PRINT_CHANGE_PAPER_SIZE (4) – Automatically set the paper size of the printer to match the image size (for virtual printers).

·         BI_PRINT_CHANGE_ORIENTATION (8) – Set the page orientation of the printer to match the image orientation.

 

pDevMode

LONGLONG

Pointer to a DEVMODE structure that specifies the printer settings for the page. Can be set to NULL if changing the settings is not needed. The DEVMODE structure must be provided if the BI_PRINT_CHANGE_PAPER_SIZE or the BI_PRINT_CHANGE_ORIENTATION flags are used.

Return Value

It is zero on success or the error code on error. If the Error Code is less than 0, use the GetLastError windows API function to get extended error information.