0049-89-49053501 support@wptools.de

Draw letterheads in WPTools editor

The event OnPaintWatermark can be used with a TWPRichText to draw a watermark.

This event is executed every time the page is rendered, either on screen, during printing and also when a PDF export is performed using the component wPDF.

The event OnPaintWatermarks received the canvas to draw to, the current resolution to draw, the rectangle of the page. It also receives the paint mode which makes it possible, to detect if currently an export to PDF takes place.

It is very easy to print a metafile as letter head:

But in some cases the customers want a letterhead they can configure.

Why not use a TWPRichText to let the user edit their letterhead?

They can add images and tables, and even movable text boxes. (requires WPTools “Premium“)

The code is almost as simple as the above – simply the PrintPageOnCanvas method for a second TWPRichText is called:

The flags wppGrayAll and wppGrayHeaderFooter are optional, they will text page be drawn using gray instead of black.

The flags wpNoViewPortAPI, wpNoViewPortOrgAPI have to be used to make sure the BackgroundRTF is rendering in the scrolling position context of the main editor.

The text in BackgroundRTF may contain page number objects. To make these use the page number of the main editor add this two assignments: