PrepareToPrintEx Method

Description         This method is similar to the PrepareToPrint method, but allows developers to pass a pointer to a printer DEVMODE structure, and all of the others parameter is same as the parameters of the PrepareToPrint. In order to get a pointer to the printer DEVMODE structure (which contains the printer settings), then you can call the BiPrintSetup method. If the first parameter is NULL, it calls the PrepareToPrint method with the default setting and ignores the PrinterName parameter.

NOTE: This method doesn’t actually print an image it just prepares the printing.


Next, for each image that should be printed, the developer must load the image and then call the PrintDIBPage method.  After calling the PrintDIBPage method, the developer must call the DropDIB method for the image if they no longer need the image.  Once all of the images have been printed, the developer must call the EndPrint method.  The psuedocode below demonstrates how several images can be print

1. BiPrintSetup
2. PrepareToPrintEx

3. While some condition (for example from 1 to number of pages)

3.a. LoadImage
3.b. PrintDIBPage
3.c. DropDIB

4. End While
5. EndPrint

Syntax                RetVal = [BIPrint.]PrepareToPrintEx  pDev PrinterName Wnd ImgName MaxPage NumCopies Display CenterVertImg CenterHorizImg ScalePage ConvertCtoB StretchPage AllPage UseDPI NotDispCancel

Returns

RetVal

Integer

zero on success or error code

on error.

 

Remarks

pDev

LONGLONG

Pointer to a DEVMODE structure

 

PrinterName

String

Name of the printer. Ignored if pDev parameter is NULL.

 

Wnd

LONGLONG

Window handle for the dialog boxes.

 

ImgName

String

A capture text to print.

 

MaxPage

Integer

Maximum page number that will be printed.

 

NumCopies

Integer

The number of copies to be printed.

 

Display

Boolean

Display the Print dialog box.

 

CenterVertImg

Boolean

Center the image vertically on the printer.

 

CenterHorizImg

Boolean

Center the image horizontally on the printer.

 

ScalePage

Boolean

Scale image to fit proportionally.

 

ConvertCtoB

Boolean

Convert bitmap to monochrome.

 

StretchPage

Boolean

Stretch bitmap to fit in a page.

 

AllPage

Boolean

Print all pages of a tiff file. If this parameter is true, the BiPrint control will display a status window during printing, with information showing the current page/total pages.

 

UseDPI

Boolean

Use DPI settings.

 

NotDispCancel

Boolean

Not display the Cancel Printing dialog box.

Usage                  After this method, use the PrintDIBPage method to print images to one or more output pages. Use the EndPrint method to finish printing. The PrintDIB method includes the PrepareToPrint, PrintDIBPage and EndPrint method calls.

See Also              PrintDIBPage Method, EndPrint Method, GetCenterVertically Method, GetCenterHorizontally Method, GetNumberOfCopies Method, GetScalePage Method, GetStretchPage Method, GetAllPages Method, GetUseDPI Method