Skip to content

Instantly share code, notes, and snippets.

@blog-aspose-cloud
Last active August 2, 2023 01:49
Watermark PowerPoint with .NET REST API

How to Watermark PowerPoint with .NET REST API


How to add watermark to PowerPoint presentations using Aspose.Slides Cloud SDK for .NET. Insert custom watermarks and images easily in PowerPoint slides with step-by-step instructions. Create professional and branded presentations effortlessly.



For more details, please visit How to Add Watermark in PowerPoint Presentation using .NET REST API.

watermark PowerPoint presentation

Important Links

Product Page | Docs | Live Demo | API Reference | Code Samples | Source Code | New Releases | Blog | Free Support | Free Trial

// For more examples, please visit https://github.com/aspose-slides-cloud
// Get client credentials from https://dashboard.aspose.cloud/
string clientSecret = "7f098199230fc5f2175d494d48f2077c";
string clientID = "ee170169-ca49-49a4-87b7-0e2ff815ea6e";
// create an instance of SlidesApi
SlidesApi slidesApi = new SlidesApi(clientID, clientSecret);
// Input PowerPoint presentation from local drive
String inputFile = "convertedFile.pptx";
// load the content of PPT in stream instance
var inputPowerPoint = System.IO.File.OpenRead(inputFile);
// Text watermark formatting details
// font height for the text watermark
int fontHeight = 30;
// Text content to be added as watermark
string watermarkText = "Confidential !";
// name of font to be used for watermarking
string fontName = "Arial";
// foregound color for watermark text
string fontColor = "Red";
// call the API to add text watermark to all the slide of PowerPoint presentation
var response = slidesApi.CreateWatermarkOnline(inputPowerPoint,null,fontHeight, watermarkText, fontName, fontColor);
// call method to save output on local drive
saveToDisk(response, "/Users/nayyer/watermarked.pptx");
// method to save stream content to file on local drive
public static void saveToDisk(Stream responseStream, String resultantFile)
{
var fileStream = File.Create(resultantFile);
responseStream.Seek(0, SeekOrigin.Begin);
responseStream.CopyTo(fileStream);
fileStream.Close();
}
How to add Text or Image watermark to PowerPoint presentation using .NET REST API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment