Watermarks and background images

In this example a watermark is displayed in the background of a page.

It shows how any watermark can be placed in the background of the page. This watermark has to be specified in a page template (<fo:simple-page-master>), if you want to have it on all pages using this page template. Alternatively, a watermark or background image can be embedded in any block.

Source code

<fo:simple-page-master page-height="297mm" page-width="210mm" margin="20mm 15mm 30mm 15mm" master-name="PageMaster.Content"> ❶          
   <fo:region-body margin="25mm 0mm 15mm 0mm" background-image="Images\confidential.EPS" background-position="center"/> ❷
      <fo:region-before .../> 
      <fo:region-after .../> 

❶ A <fo:simple-page-master> is defined. It determines the structure and the layout of a page.

❷ The watermark is embedded in the <fo:region-body> element and is displayed in the body region of the page. The background-image attribute determines the path to the background image to be inserted. With the background-position attribute its position is determined (in this example the background image is centred).


<< back next >>

Copyright © dpunkt.verlag GmbH 2004
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSL-FO in der Praxis" ("XSL-FO in practice") is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.

dpunkt.verlag GmbH, Ringstraße 19B, 69115 Heidelberg, fon 06221-14830, fax 06221-148399, hallo@dpunkt.de