PPTX DOCX XLSX PDF ODP
Aspose.Slides  for C++
PPT

Add Text Watermark to PPT in C++

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

Watermark PPT File Using C++

In order to watermark PPT file, we’ll use

Aspose.Slides 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.Slides.Cpp and install. You may also use the following command from the Package Manager Console.

Command


PM> Install-Package Aspose.Slides.Cpp

How to Add Watermark to PPT via C++

You need the aspose.slides.dll to try the following workflow in your own environment.

  1. Load PPT files with an instance of Presentation class

  2. Get the first slide

  3. Add an AutoShape of Rectangle type

  4. Add TextFrame to the Rectangle

  5. Create the Paragraph object for text frame

  6. Create Portion object for paragraph

  7. Add watermark using set_Text()

  8. Save document

System Requirements

Aspose.Slides for C++ supports on all major platforms and Operating Systems. Please make sure that you have the following prerequisites.

 

Add Watermark to PPT - C++


// Load the desired PPT File
SharedPtr<Presentation> pres = MakeObject<Presentation>(u"templatePath.ppt");

// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);

// Add an AutoShape of Rectangle type
SharedPtr<IAutoShape>  ashp = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 150, 75, 150, 50);

ashp->get_FillFormat()->set_FillType(FillType::NoFill);

// Add TextFrame to the Rectangle
ashp->AddTextFrame(u" ");

// Accessing the text frame
SharedPtr<ITextFrame>  txtFrame = ashp->get_TextFrame();

// Create the Paragraph object for text frame
SharedPtr<IParagraph> paragraph = txtFrame->get_Paragraphs()->idx_get(0);

// Create Portion object for paragraph
SharedPtr<IPortion> portion = paragraph->get_Portions()->idx_get(0);
portion->set_Text(u"Watermark Text Watermark Text Watermark Text");

//Adding another shape
SharedPtr<IAutoShape>  ashape2 = slide->get_Shapes()->AddAutoShape(ShapeType::Triangle, 200, 365, 400, 150);

//Reorder shape
slide->get_Shapes()->Reorder(2, ashape2);

// Save PPT to Disk
pres->Save(u"outPath.ppt", Aspose::Slides::Export::SaveFormat::Ppt);  
 
  • About Aspose.Slides for C++ API

    Aspose.Slides API can be used to read, write, manipulate and convert Microsoft PowerPoint documents to PDF, XPS, HTML, TIFF, ODP and various other formats. One can create new files from scratch and save those in the relevant supported formats. Aspose.Slides is a standalone API for creating, parsing or manipulating presentations, slides and elements and it does not depend on any software like Microsoft or OpenOffice.

    Watermark PPT via Online App

    Other Supported Watermarking Formats

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

    PPTX (Open XML presentation Format)