Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aspose-cloud-kb/a071236f59cf8d72afd9f02688bd7c23 to your computer and use it in GitHub Desktop.
Save aspose-cloud-kb/a071236f59cf8d72afd9f02688bd7c23 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.IO;
using Aspose.Slides.Cloud.Sdk;
using Aspose.Slides.Cloud.Sdk.Model;
namespace AsposeKbExamples
{
public class MergePresentations
{
static void Merge()
{
SlidesApi api = new SlidesApi("Client ID", "Client secret");
string fileName = "MyPresentation.pptx";
string inputFile1 = "1-NewSales.pptx";
string inputFile2 = "2-NewSales.pptx";
try
{
FilesUploadResult result = api.UploadFile(fileName, new MemoryStream(File.ReadAllBytes(fileName)));
result = api.UploadFile(inputFile1, new MemoryStream(File.ReadAllBytes(inputFile1)));
result = api.UploadFile(inputFile2, new MemoryStream(File.ReadAllBytes(inputFile2)));
// Prepare request data for presentations to merge.
var request = new PresentationsMergeRequest
{
PresentationPaths = new List<string> { inputFile1, inputFile2 }
};
// Merge the presentations.
var response = api.Merge("MyPresentation.pptx", request);
Console.WriteLine("Self Uri Href" + response.SelfUri.Href);
// Download created pdf file
Stream storageRes = api.DownloadFile(fileName);
FileStream fileStream = new FileStream("AfterMerging.pptx", FileMode.Create, FileAccess.Write);
storageRes.CopyTo(fileStream);
}
catch(Exception ex)
{
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment