Watermarks

  • 2 minutes to read

This document describes watermarks: how they can be accessed, assigned to a document's pages, modified and saved/restored.

For a document's PrintingSystem, you can specify a watermark (via the PrintingSystemBase.Watermark property), which can be represented by either text or a picture, or both (which is specified via the PageWatermark.Text and PageWatermark.Image properties respectively).

A watermark object is represented by an instance of the Watermark class, and it can be assigned to a document using the Watermark.CopyFrom method, as it is demonstrated in the following tutorial: How to: Add a Watermark to a Document.

After a Document has been generated, its Document.Pages contain PageWatermark objects, which can be accessed via the Page.Watermark property.

When a watermark is specified for a document, it is applied to all pages. To specify individual watermarks for particular pages, use the Page.AssignWatermark method, as demonstrated in the following tutorial: How to: Add Different Watermarks to Document Pages .

The Watermark class inherits all its options from the base PageWatermark class. Among these options, the following ones have effect on text watermarks only.

And, the following options have effect on image watermarks only.

Finally, the PageWatermark.ShowBehind property is available for both text and image watermarks.

In Print Preview, access to watermark settings is provided by the Watermark PrintPreviewBar.Watermark toolbar button and the corresponding menu item, both triggering the following printing system command: PrintingSystemCommand.Watermark.

This command raises the Watermark dialog (similar to the one of the PrintingSystemBase.Watermark property) which is used to specify both text and picture watermark options.

Watermarks_Dialog

Note that these settings can be saved into an XML-file, memory stream or a system registry, and then be restored from there, using appropriate methods. For a tutorial on this, refer to How to: Save and Restore a Document's Watermark in Print Preview.

To control whether a document's watermarks should be preserved when the document is being exported to RTF, use the FormattedTextExportOptions.ExportWatermarks property.

See Also