Add Watermark to PPTX Presentation using C++
Build your own C++ apps to insert text or image watermark into PPT, PPTX, or ODP presentation using server-side APIs.
Add Watermark to PPTX Presentation via C++
Using Aspose.Slides for C++, you can add watermark to PPTX presentation. Watermarks are an essential part of any presentation. They are used to protect the content of the presentation from being copied or used without permission. A watermark is a visible or invisible image or text that is placed on top of the presentation. It can be used to identify the owner of the presentation and to prevent unauthorized use. Watermarks can also be used to add a professional touch to the presentation and to make it look more polished.
Add Text Watermark to PPTX using C++
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slides()->idx_get(0);
auto master = presentation->get_Masters()->idx_get(0);
auto watermarkShape = slide->get_Shapes()->AddAutoShape(ShapeType::Triangle, 0.0f, 0.0f, 0.0f, 0.0f);
auto watermarkTextFrame = watermarkShape->AddTextFrame(u"Watermark");
presentation->Save(u"watermark.pptx", SaveFormat::Pptx);
Add Image Watermark to PPTX Presentation using C++
auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slides()->idx_get(0);
auto master = presentation->get_Masters()->idx_get(0);
auto watermarkShape = slide->get_Shapes()->AddAutoShape(ShapeType::Triangle, 0.0f, 0.0f, 0.0f, 0.0f);
auto image = presentation->get_Images()->AddImage(:File::ReadAllBytes(u"watermark.png"));
watermarkShape->get_FillFormat()->set_FillType(FillType::Picture);
watermarkShape->get_FillFormat()->get_PictureFillFormat()->get_Picture()->set_Image(image);
watermarkShape->get_FillFormat()->get_PictureFillFormat()->set_PictureFillMode(PictureFillMode::Stretch);
presentation->Save(u"watermark2.pptx", SaveFormat::Pptx);
How to Add Watermark to PPTX via C++
These are the steps to add text watermark to PPTX files.
Load PPTX with an instance of Presentation
Select the master presentation
Add shape type using AddAutoShape method
Add watermark text using AddTextFrame method
Save result in PPTX format