Wordize for .NET provides C# developers with specialized tools for programmatically adding watermarks to Word documents. The library ensures complete control over watermark integration in Word files through SetText() methods for text elements and SetImage() for graphics. Additionally, the SetWatermarkToImages() method converts Word pages with watermarks into images.
To test the functionality, upload a Word document to the upload field, configure watermark parameters, and download the result for verification.
using Wordize.Watermarking;
Watermarker.SetText("Input.docx", "Output.docx", "Text");
using Wordize.Watermarking;
Watermarker.SetText("{{input1}}", "{{output}}", "{{text1}}");
using Wordize.Watermarking;
using Wordize.Saving;
var imageStreams = Watermarker.SetWatermarkToImages("{{input1}}", new ImageSaveOptions(SaveFormat.{{saveFormat}}), "{{text1}}");
foreach (var (stream, page) in imageStreams.Select((s, i) => (s, i)))
{
using var _ = stream;
stream.Position = 0;
using var file = File.Create($"Output_{page + 1}.{{outputExt}}");
stream.CopyTo(file);
}
using Wordize.Watermarking;
Watermarker.SetImage("Input.docx", "Output.docx", "Watermark.jpg");
using Wordize.Watermarking;
Watermarker.SetImage("{{input1}}", "{{output}}", "{{input2}}");
using Wordize.Watermarking;
using Wordize.Saving;
byte[] watermarkImageBytes = File.ReadAllBytes("{{input2}}");
var imageStreams = Watermarker.SetWatermarkToImages("{{input1}}", new ImageSaveOptions(SaveFormat.{{saveFormat}}), watermarkImageBytes);
foreach (var (stream, page) in imageStreams.Select((s, i) => (s, i)))
{
using var _ = stream;
stream.Position = 0;
using var file = File.Create($"Output_{page + 1}.{{outputExt}}");
stream.CopyTo(file);
}
Connect Wordize SDK to your .NET project
Call the Watermarker.SetText() method to insert a text watermark or Watermarker.SetImage() for an image watermark, specifying the Word document and watermark properties as parameters
Get the Word document with the added watermark