Add Text Watermark to RTF via C++
Build your own C++ apps to watermark RTF files using server-side APIs.
How to Watermark RTF File Using C++
In order to watermark RTF file, we’ll use
API which is a feature-rich, powerful and easy to use document watermarking API for C++ platform. You can download its latest version directly, just open
package manager, search for Aspose.Words.Cpp and install. You may also use the following command from the Package Manager Console.
PM> Install-Package Aspose.Words.Cpp
Steps to Add Watermark to RTF via C++
You need the
to try the following workflow in your own environment.
- Load RTF files with an instance of Document
- Set different properties for text watermark
- Call SetText method and pass watermark text & object of TextWatermarkOptions
- Save the document
Aspose.Words for C++ supports on all major platforms and Operating Systems. Please make sure that you have the following prerequisites.
- Microsoft Windows or a compatible OS with C++ Runtime Environment for Windows 32 bit, Windows 64 bit and Linux 64 bit.
- Aspose.Words for C++ DLL referenced in your project.
Add Watermark to RTF - C++
// Load input rtf document auto rtf = System::MakeObject<Document>(inputDataDir + u"Document.rtf"); // Set different properties for text watermark auto options = System::MakeObject<TextWatermarkOptions>(); options->set_FontFamily(u"Arial"); options->set_FontSize(36); options->set_Color(System::Drawing::Color::get_Black()); options->set_Layout(WatermarkLayout::Horizontal); options->set_IsSemitrasparent(false); // Set text for the watermark rtf->get_Watermark()->SetText(u"Test", options); auto outputPath = outputDataDir + u"AddTextWatermark.rtf"; rtf->Save(outputPath);
About Aspose.Words for C++ APIAspose.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. Aspose.Words 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.
Watermark RTF via Online App
Other Supported Watermarking Formats
Using C++, one can easily watermark different formats including.