|
// 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(); |
|
} |