Paginate2

 

Description

 

Perform a printer-targeted page layout to prepare for page-by-page printing and determine the total printable page count for this HTML page.

 

Arguments

 

Name

Type

I/O

Description

hDC

HDC

In

A Device Context for the destination printer.

lPageLeft

Long Integer

In

The left margin on the printable page (x coordinate) in pixels.

lPageTop

Long Integer

In

The left margin on the printable page (y coordinate) in pixels.

lPageRight

Long Integer

In

The right end of the print area (x coordinate) on the printable page in pixels.

lPageBottom

Long Integer

In

The bottom end of the print area (y coordinate) on the printable page in pixels.

plTotalPages

Long Integer (by Reference)

Out

The computed number of printable pages.

 

Return Value

 

Long Integer: a status value. It can be one of:

 

0

PRINTER_OK

Success

-1

PRINTERR_BAD_DC

The DC passed in was Null or bad.

-2

PRINTERR_BAD_PAGERECT

The PageRect specified had a top left corner that was less than (0, 0) or was specified with values that would yield an empty page, for example(50, 50, 500, 50).

-3

PRINTERR_BAD_HTMLPAGE

No HTML page loaded (internal error).

-4

PRINTERR_BAD_PAGENUM

The page number passed to PrintToDC was less than 0 or greater than the maximum number of pages returned by a previous call to the Paginate2 method.

-5

PRINTERR_BAD_PAGETABLE

There was no page table entry for the page number specified (internal error).

-6

PRINTERR_BAD_PRINTER

The printer specified does not support bitmap graphics.

 

Remarks

 

The easy way to print a page is via the DoPrint method. The Paginate2, PrintToDC and EndPrint methods provide more comprehensive control over the printing process and are most useful in an MFC environment. MFC- based containers would call Paginate2 in “CMyView:: OnPreparePrinting()”.

 

Container applications must call this method after the user has selected a printer and any options associated with that printer. Webster will use the information passed in to divide the currently displayed HTML document into printable pages. Webster remembers this “printable page configuration” and uses it when the PrintToDC method is called. Thus, if the user changes the paper size, or orientation, or printer type, etc. Paginate2 must be called afterward to inform Webster of these changes. Webster will then re-calculate the “printable page configuration”.