PPTX DOCX XLSX PDF ODP
Aspose.Words  for C++
DOC

Add Text Watermark to DOC via C++

Build your own C++ apps to watermark DOC files using server-side APIs.

How to Watermark DOC File Using C++

In order to watermark DOC file, we’ll use

Aspose.Words for C++

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

NuGet

package manager, search for Aspose.Words.Cpp and install. You may also use the following command from the Package Manager Console.

Command


PM> Install-Package Aspose.Words.Cpp

Steps to Add Watermark to DOC via C++

You need the

aspose.words.dll

to try the following workflow in your own environment.

  1. Load DOC files with an instance of Document
  2. Set different properties for text watermark
  3. Call SetText method and pass watermark text & object of TextWatermarkOptions
  4. Save the document

System Requirements

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 DOC - C++


// Load input doc document
auto doc = System::MakeObject<Document>(inputDataDir + u"Document.doc");

// 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
doc->get_Watermark()->SetText(u"Test", options);

auto outputPath = outputDataDir + u"AddTextWatermark.doc";

doc->Save(outputPath);  
 
  • About Aspose.Words for C++ API

    Aspose.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 DOC via Online App

    Other Supported Watermarking Formats

    Using C++, one can easily watermark different formats including.

    DOCX (Office 2007+ Words Document)
    DOT (Microsoft Word Template Files)
    DOTX (Microsoft Word Template File)
    ODT (OpenDocument Text File Format)
    OTT (OpenDocument Standard Format)
    RTF (Rich Text Format)