Watermark
Use the Wordize Watermark for .NET module to add a watermark to your document. You can also select any document conversion module to work with the required formats.
A full list of conversion modules can be found on the Supported Document Formats page.
Wordize provides the Wordize Watermark module for .NET, which offers robust functionality for adding watermarks to your documents, enhancing security and branding. You can insert both text and image watermarks with customizable options to suit your requirements.
Watermark Types
A watermark is inserted behind the main document content. You can add an image or text watermark:
- Image watermark: insert images, such as logos or seals, as watermarks
- Text watermark: inserts text such as “Confidential” or “Draft” as a watermark
Adding an Image Watermark
Use one of the SetImage methods to add an image watermark:
- SetImage(string, string, string)
- SetImage(string, string, SaveFormat, string)
The following code example shows how to add an image watermark into a document using the SetImage(string, string, string) method:
string doc = MyDir + "Document.docx";
string watermarkImage = ImageDir + "Logo.jpg";
Watermarker.SetImage(doc, ArtifactsDir + "SetWatermarkImage.1.docx", watermarkImage);
The following code example shows how to add an image watermark into a document, specifying a save format and using the SetImage(string, string, SaveFormat, string) method:
string doc = MyDir + "Document.docx";
string watermarkImage = ImageDir + "Logo.jpg";
Watermarker.SetImage(doc, ArtifactsDir + "SetWatermarkText.2.docx", SaveFormat.Docx, watermarkImage);
Adding a Text Watermark
Use one of the SetText methods to add a text watermark:
- SetText(string, string, string)
- SetText(string, string, SaveFormat, string)
- SetText(Stream, Stream, SaveFormat, string)
- SetText(string, string, string, TextWatermarkOptions)
- SetText(Stream, Stream, SaveFormat, string, TextWatermarkOptions)
- SetText(string, string, SaveFormat, string, TextWatermarkOptions)
The following code example shows how to add a text watermark into a document using the SetText(string, string, string) method:
string doc = MyDir + "Document.docx";
string watermarkText = "This is a watermark";
Watermarker.SetText(doc, ArtifactsDir + "WatermarkText.1.docx", watermarkText);
The following code example shows how to add a text watermark into a document, specifying a save format and using the SetText(string, string, SaveFormat, string) method:
string doc = MyDir + "Document.docx";
string watermarkText = "This is a watermark";
Watermarker.SetText(doc, ArtifactsDir + "WatermarkText.2.docx", SaveFormat.Docx, watermarkText);
The following code example shows how to add a text watermark into a document, specifying a save format and using the SetText(Stream, Stream, SaveFormat, string) method:
using (FileStream streamIn = new FileStream(MyDir + "Document.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream streamOut = new FileStream(ArtifactsDir + "WatermarkTextStream.1.docx", FileMode.Create, FileAccess.ReadWrite))
Watermarker.SetText(streamIn, streamOut, SaveFormat.Docx, watermarkText);
}
The following code example shows how to add a text watermark into a document, specifying text watermark options and using the SetText(string, string, string, TextWatermarkOptions) method:
string doc = MyDir + "Document.docx";
string watermarkText = "This is a watermark";
TextWatermarkOptions watermarkOptions = new TextWatermarkOptions();
watermarkOptions.Color = Color.Red;
Watermarker.SetText(doc, ArtifactsDir + "WatermarkText.3.docx", watermarkText, watermarkOptions);
The following code example shows how to add a text watermark into a document, specifying a save format, text watermark options and using the SetText(Stream, Stream, SaveFormat, string, TextWatermarkOptions) method:
using (FileStream streamIn = new FileStream(MyDir + "Document.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream streamOut = new FileStream(ArtifactsDir + "WatermarkTextStream.2.docx", FileMode.Create, FileAccess.ReadWrite))
{
TextWatermarkOptions options = new TextWatermarkOptions();
options.Color = Color.Red;
Watermarker.SetText(streamIn, streamOut, SaveFormat.Docx, watermarkText, options);
}
}
The following code example shows how to add a text watermark into a document, specifying a save format, text watermark options and using the SetText(string, string, SaveFormat, string, TextWatermarkOptions) method:
string doc = MyDir + "Document.docx";
string watermarkText = "This is a watermark";
TextWatermarkOptions watermarkOptions = new TextWatermarkOptions();
watermarkOptions.Color = Color.Red;
Watermarker.SetText(doc, ArtifactsDir + "WatermarkText.4.docx", SaveFormat.Docx, watermarkText, watermarkOptions);