Watermark Documents and Images using C++ APIs

Add text and image watermark to Microsoft Word, Excel, Powerpoint presentations, PDF and Images using Aspose.Total for C++.

 Watermark via Python  Watermark via C# .NET  Watermark via Java  Watermark in Android Apps

 

Document watermarking serves as a crucial tool for protecting the integrity and ownership of digital documents. By embedding visible or invisible marks, such as text, logos, or patterns, into documents, watermarking enables content creators to assert their ownership and deter unauthorized use or distribution. Additionally, watermarking enhances document security by discouraging tampering or forgery, as any alterations to the document’s content become readily apparent.

Integrating document watermarking into a C++ application offers enhanced content authentication, ownership assertion, and copyright protection. Visible or invisible marks embedded within documents deter unauthorized use and reinforce brand identity. This ensures compliance with legal regulations while providing traceability and accountability in collaborative environments, strengthening overall document security.

Add Watermark to PDF Files

With Aspose.Total for C++, incorporating Aspose.PDF, developers can seamlessly add watermarks to PDF documents within C++ applications. This powerful solution allows for the integration of visible or invisible watermarks, providing a versatile approach for branding, security, or document identification. Aspose.PDF within Aspose.Total offers customization options for watermark content, position, and appearance, ensuring flexibility in meeting specific business requirements. Whether adding copyright information, document status, or branding elements, Aspose.PDF simplifies the process of watermarking PDFs, contributing to enhanced document communication, security, and professional presentation within C++ applications.

C++ Code: Watermark PDF Documents

String _dataDir("C:\\Samples\\");
String inputFileName("watermark.pdf");
String outputFileName("watermark_out.pdf");
auto document = MakeObject<Document>(_dataDir + inputFileName);
auto artifact = MakeObject<WatermarkArtifact>();
auto textState = MakeObject<TextState>();
textState->set_FontSize(72);
textState->set_ForegroundColor(Color::get_Blue());
textState->set_Font(FontRepository::FindFont(u"Courier"));
artifact->SetTextAndState(u"WATERMARK", textState);
artifact->set_ArtifactHorizontalAlignment (HorizontalAlignment::Center);
artifact->set_ArtifactVerticalAlignment (VerticalAlignment::Center);
artifact->set_Rotation(45);
artifact->set_Opacity(0.5);
artifact->set_IsBackground(true);
document->get_Pages()->idx_get(1)->get_Artifacts()->Add(artifact);
document->Save(_dataDir + outputFileName);

Watermarking Microsoft Word Documents

Aspose.Total for C++ facilitates seamless watermarking of Microsoft Word documents, offering a robust solution for asserting ownership and document security. With precise APIs, developers can effortlessly insert text, images, or logos as visible or invisible watermarks into Word files. This feature empowers users to safeguard their intellectual property, deter unauthorized use, and reinforce brand identity effectively. Moreover, Aspose.Total enables developers to customize watermark positioning and appearance, ensuring optimal integration with specific document requirements. Leveraging Aspose.Total for watermarking in C++ applications ensures reliable protection and preservation of valuable content within Microsoft Word documents.

C++ Code: Watermark Word Documents

Similarly, Aspose.Cells facilitates the watermarking of Microsoft Excel spreadsheets, allowing developers to integrate watermarks for branding or security purposes. Whether it’s adding company logos, disclaimers, or document status indicators, Aspose.Cells within Aspose.Total provides the tools to customize watermark content and appearance within Excel files.

C++ Code: Watermarking Excel Spreadsheets

intrusive_ptr<IWorkbook> wb = Factory::CreateIWorkbook();
intrusive_ptr<IWorksheetCollection> wsc = wb->GetIWorksheets();
intrusive_ptr<IWorksheet> ws = wsc->GetObjectByIndex(0);
intrusive_ptr<IShape> wordart = ws->GetIShapes()->AddITextEffect(MsoPresetTextEffect_TextEffect1,
new String("CONFIDENTIAL"), new String("Arial Black"), 50, false, true
, 18, 8, 1, 1, 130, 800);
intrusive_ptr<IFillFormat> wordArtFormat = wordart->GetIFillFormat();
wordArtFormat->SetTransparency( 0.9);
wb->Save(new String("Watermark_Text.xlsx"));