<< Click to Display Table of Contents >> Navigation: Programming > Printing and PDF Export > Watermarks |
Watermarks are drawings which are printed before the actual contents of a page is printed.
In WPTools Version 9 Watermarks have to be printed inside the event handler for OnPaintWatermark.
This event gets this parameters:
Sender | a reference to the TWPRichText component which tiggered the event |
RTFEngine | is the RTF Engine (= TWPRichText.Memo) |
toCanvas | the drawing canvas for the output. During printtime this is the printer canvas. |
PageRect | the bounding rectangle of the page. During printime the Top,Left coordinate is set to the negative physical offset to make it easy to print at exact positions. |
PaintPageNr | the number of the page, 0 based |
RTFPageNr | 0 or the number of the text page which is printed later over the watermark. You can access the definition object (class TWPVirtPage) of this page by reading |
RTFEngine.DisplayedText.Pages[RTFPageNr - 1]. |
WaterMarkRef | reserved |
XRes and YRes | define the current resolution. This is very important to convert real coordinates into coordinates on the virtual paper. You can use this functions to convert CM into pixles. The result value has to be added to PageRect.Left or PageRect.Top. |
function XP(cm: Double): Integer;
begin
Result := MulDiv(WPCentimeterToTwips(cm), Xres, 1440);
end;
function YP(cm: Double): Integer;
begin
Result := MulDiv(WPCentimeterToTwips(cm), Yres, 1440);
end;
CurrentZoom | specifies the zooming the editor uses, at printtime it is 1 |
PaintMode | the paint mode which is currently used. By checking for 'wppInPaintDesktop' you can write code which is no active at print time. wppInPaintForwPDF is set while exporting to wPDF, wppOutputToPrinter when printing. |