Type ThtmlPagePrinted


Declaration

ThtmlPagePrinted = procedure(Sender: TObject; HFViewer: THtmlViewer;

NumPage: Integer; LastPage: boolean;

var XL, XR: integer;

var StopPrinting: Boolean) of Object;;

Description

The ThtmlPagePrinted type is the type for the OnPrintHTMLHeader and OnPrintHTMLFooter events. These events occur as each page is printed allowing the user to add an HTML formatted header and/or footer to the page.

SenderThe THtmlViewer which is printing.

HFViewerThe THtmlViewer to take the header or footer document.

NumPageThe current page number.

LastPageA boolean set to True for the last page.

XL, XRHeader/footer left and right pixel boundaries.

StopPrintingSet this True to abort the print job.

Usage Notes:

These events print (or preview) HTML documents which serve as headers and footers for the print job. This is done by using two ThtmlViewers, one positioned for the header and the other for the footer. These ThtmlViewers are used only for printing and are never visible. The user supplies an event handler which loads the desired HTML into the THtmlViewer (the HFViewer parameter).

The event handler need not be concerned with creating or destroying the THtmlViewer as this is done automatically. The THtmlViewer comes with default settings with the exception of the MarginHeight propertywhich is set at 0. It's only necessary to load the desired HTML using any of the usual load methods. If the header or footer does not change between pages, it need only be loaded once. However, if the HTML does change, it can be reloaded for each page.

The header THtmlViewer is positioned so that it's bottom edge is directly above the print job text. This is true regardless of the amount of text. Thus if there is too much text, the early text will disappear off the top of the page. The user needs to insure that the PrintMarginTop property is set adequately. Note that the MarginHeight attribute (<body> tag) can be used to set the spacing at the bottom of the header text.

The footer THtmlViewer is positioned so that it's top is directly below the print job text. In this case, excessive text will flow off the bottom of the page. Again, the MarginHeight attribute can be used to control the spacing at the top of the footer.

The XL and XR parameters can be used to control the left and right side positioning of the header or footer. These parameters are preset to values such that the header or footer will align with the print job. Hence, in most cases, these parameters can be ignored. If it's desired to extend the header or footer into the normal margin area, then these parameter would be useful. Note that for proper text alignment, the MarginWidth attribute (<body> tag) must be the same for both the print job and the header or footer.

See also:

MarginHeight Property

MarginWidth Property

PrintMargin Properties

OnPrintHeader

OnPrintFooter