In order to add watermarks to documents, images are inserted into a page headers of each section. The content of headers (and footers) are repeated on each page automatically. FrameBase TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
FrameBase Class
The FrameBase class is the base class of the Image, TextFrame, ChartFrame, BarcodeFrame and DrawingFrame classes.
objects including images can be inserted into a header by overlapping the main text.

Scalable SVG Images

Since version 30.0, TX Text Control supports the insertion of SVG images which is the preferred image format for watermarks. The advantage of using SVG images is that they, as the name "Scalable Vector Graphics" implies, are scalable. One SVG image can be used for all required sizes in any document.

Watermark in TX Text Control

Positioned Behind Text

Additionally, objects can be positioned behind the actual text, so that the text is still visible and the watermark can be seen virtually in the background of a document. To achieve this, the following implementation of the Images.Add TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
ImageCollection Class
Add Method
Inserts a new image in a Text Control document.
method must be used:


The required enumeration combination for the InsertionMode is FixedOnPage and BelowTheText:


Center the Image

Finally, the image must be centered vertically and horizontally on each page of each section in case there are different page sizes and orientations. The following formula is used to calculate the location of the background images:

([Page width] - [image width] - [both page margins]) / 2

The following diagram shows the various values that must be considered into the calculation of the exact horizontal location:

Center image

The following method AddWatermark creates headers for each section in order to insert a watermark centered on each page of the document:


This method is called with an instance of a ServerTextControl (same code is compatible to Windows Forms and WPF) and a path to the image. In the following code, an HttpGet method is implemented to load any document to add a watermark to the document pages: