Add text watermarks

To add a watermark to the HTML/JPG/PNG/PDF output, follow these steps:

  1. Create an instance of the HtmlViewOptions class (or PngViewOptions, or JpgViewOption, or PdfViewOptions);
  2. Create a Watermark object and populate its properties;
  3. Assign the Watermark object to HtmlViewOptions.Watermark (or PngViewOptions.Watermark, or JpgViewOptions.Watermark, or PdfViewOptions.Watermark) property;
  4. Call the View method.

The following code snippet shows how to apply the watermark to the output pages.

using (Viewer viewer = new Viewer("sample.docx"))
    // Create an HTML file.
    HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources();
    // Add watermark
    viewOptions.Watermark = new Watermark("This is a watermark");