Top  Previous  Next

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.


PaintPageNrthe number of the page, 0 based


RTFPageNr0 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].




XRes and YResdefine 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;


   Result := MulDiv(WPCentimeterToTwips(cm), Xres, 1440);



function YP(cm: Double): Integer;


   Result := MulDiv(WPCentimeterToTwips(cm), Yres, 1440);



CurrentZoomspecifies the zooming the editor uses, at printtime it is 1


PaintModethe 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.