PPTX
DOCX
XLSX
PDF
ODP
OTT
Add Text Watermark to OTT via C#
Build your own .NET apps to watermark OTT files using server-side APIs.
How to Watermark OTT File Using C#
In order to watermark OTT file, we’ll use
API which is a feature-rich, powerful and easy to use document manipulation API for C# platform. Open
package manager, search for Aspose.Words and install. You may also use the following command from the Package Manager Console.
Command
PM> Install-Package Aspose.Words
Steps to Add Watermark to OTT via C#
Developers can easily watermark Microsoft Word OTT files by executing the following workflow.
- Load OTT files with an instance of Document
- Create an instance of TextWatermarkOptions and set its properties
- Call Watermark.SetText method and pass watermark text & object of TextWatermarkOptions
- Save the document in any desierd format
System Requirements
Before integrating code, make sure that you have the following prerequisites.
- Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms.
- Development environment like Microsoft Visual Studio.
- Aspose.Words for .NET referenced in your project.
Add Watermark to OTT - C#
// load OTT in an instance of Document
var document = new Document("template.ott");
// create an instance of TextWatermarkOptions and set its properties
var options = new TextWatermarkOptions()
{
FontFamily = "Arial",
FontSize = 36,
Color = System.Drawing.Color.Black,
Layout = WatermarkLayout.Horizontal,
IsSemitrasparent = false
};
// set watermark text with the object of TextWatermarkOptions
document.Watermark.SetText("CONFIDENTIAL", options);
.NET Words API can be used to load, view and convert Microsoft Word and OpenDocument Formats like DOC, DOCX, ODT to PDF, XPS, HTML and various other formats. You can also create new documents from scratch and save them in the supported formats. It is a standalone API that is suitable for server side and backend systems where high performance is required. It does not depend on any software like Microsoft or OpenOffice.