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.Watermarks 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).
The PrintingSystemBase.Watermarks property holds a WatermarkCollection that contains all Watermark objects in the document. To add a watermark to a document, call the Watermark.CopyFrom method or add a watermark to the collection.
Refer to the following tutorial for more information: How to: Add a Watermark to a Document.
When a watermark is specified for a document, it is applied to all pages. To specify individual watermarks for particular pages, use the Page.WatermarkId property or call the Page.AssignWatermark method.
Refer to the following tutorial for more information:: How to: Add Different Watermarks to Document Pages .
The Watermark class inherits its options from the base PageWatermark class.
The following options have effect on text watermarks only:
- PageWatermark.Font;
- PageWatermark.ForeColor;
- PageWatermark.Text;
- PageWatermark.TextDirection;
- PageWatermark.TextTransparency;
- PageWatermark.TextPosition
The following options have effect on image watermarks only:
- PageWatermark.Image;
- PageWatermark.ImageAlign;
- PageWatermark.ImageTiling;
- PageWatermark.ImageTransparency;
- PageWatermark.ImageViewMode;
- PageWatermark.ImagePosition
Both text and image watermarks have the Watermark.Id property. The unique identifier of a watermark used to specify the watermark in the Page.WatermarkId property.
In Print Preview, access to watermark settings is provided by the 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.Watermarks property) which is used to specify both text and picture watermark options.
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.