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("Input.docx", "Output.docx", "Text");
using Wordize.Watermarking;
using Wordize.Saving;
var imageStreams = Watermarker.SetWatermarkToImages("Input.docx", new ImageSaveOptions(SaveFormat.Docx), "Text");
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}.docx");
stream.CopyTo(file);
}
using Wordize.Watermarking;
Watermarker.SetImage("Input.docx", "Output.docx", "Watermark.jpg");
using Wordize.Watermarking;
Watermarker.SetImage("Input.docx", "Output.docx", "Watermark.jpg");
using Wordize.Watermarking;
using Wordize.Saving;
byte[] watermarkImageBytes = File.ReadAllBytes("Watermark.jpg");
var imageStreams = Watermarker.SetWatermarkToImages("Input.docx", new ImageSaveOptions(SaveFormat.Docx), 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}.docx");
stream.CopyTo(file);
}