Convert PDF to PowerPoint Presentation with C# REST API

Follow this article to convert PDF to PowerPoint presentation with C# REST API. You will learn the process of inserting a PDF into PowerPoint with C# Low Code API using a .NET-based Cloud SDK. It will take a couple of API calls to transform a complete PDF into a presentation.

Prerequisite

Steps for Converting PDF to PowerPoint Presentation with C# .NET-based API

  1. Instantiate the SlidesApi object using the client ID and secret for converting PDF to a PPTX
  2. Load the source PDF file into a memory stream for transformation to a PowerPoint presentation
  3. Invoke the ImportFromPdf() method by setting the output presentation name and source PDF stream
  4. Download the presentation from the Cloud with PDF pages as slides in it

These steps explain how to convert a PDF to PowerPoint presentation with C# REST API. Initialize the SlidesApi object to work with this feature, load the source PDF file into a memory stream, and call the ImportFromPdf() method by providing the output presentation name and the stream containing the PDF contents. You may download the resultant presentation file using the output presentation name given above.

Code for Importing a PDF into PowerPoint with C# REST API

using Aspose.Slides.Cloud.Sdk;
using Aspose.Slides.Cloud.Sdk.Model;
using System;
using System.IO;
namespace AsposeTestCodes
{
class Program
{
static void Main(string[] args)//Main method for converting PDF to PPTX
{
SlidesApi slidesApi = new SlidesApi("Client ID", "Secret");// Instantiate the SlidesApi
var streamPdf = new MemoryStream(File.ReadAllBytes("sample.pdf"));// Load the source PDF
var result = slidesApi.ImportFromPdf("output.pptx", streamPdf); // Change PDF to PPTX
Stream stream = slidesApi.DownloadFile("output.pptx"); // Download the output
var fs = new FileStream("Downloaded.pptx", FileMode.Create, FileAccess.Write); //Save the output
stream.CopyTo(fs);
}
}
}

This code has demonstrated how to change a PDF into PowerPoint with C# RESTful Service. You may set the Options for detecting tables in the source PDF and rendering in the output presentation. Options are also available for setting the password for opening the source PDF file if protected.

This article has taught us the process of saving a PDF as presentation with C# REST Interface. For adding hyperlinks to a presentation, refer to the article on Add hyperlink to PowerPoint with C# REST API.

 English