Ask Reuben

Report Watermark

How can I add a watermark to a report?

The question of how to add a watermark to a report normally arises because the developer is looking for an option to rotate text 45 degrees.

The steps to add a watermark involve two things…

  1. Rather than rotating text 45 degrees, create an image where the text inside the image has already been rotated 45 degrees.  You can use the Watermark feature of Microsoft Word to create what you want and then take a screen snapshot of this to create your image.
  2. To position this watermark image in the center of the page, add the Image Box (or you can use a Word Box if you don’t want the text rotated) to a Page Header node with the following properties …

The Floating Behaviour = free property means that the object is not constrained by the size of its parent node and can lie outside it.  Similarly the size of the parent node does not take this object into consideration.

The values of X,Y, Anchor X, Anchor Y properties combine to place the center of the Image in the center of the page, meaning no matter what size the object is or its parent, it will appear in the center.

By placing in the Page Header also means that any content in the page will be rendered on top of it.  That is the watermark will not obscure the content of your report.  When a page is rendered, first things rendered are the page headers and page footers, then it knows how much space is available for the content of the page.

So by creating the following image …

Using the Reports demo from Tutorials & Samples, using OrderReport.4rp,  adding ImageBoxes as last child of the Page Header nodes …

… and applying the property values as described above results in the following, the image containing the rotated “DRAFT” text is positioned in the center of the page behind the page content …