Articles in this section
Category / Section

How the PowerPoint slide be converted to image using .NET Azure WebServices?

3 mins read

You can create, edit, and convert the PowerPoint files without Microsoft Office dependencies in .NET Azure web services using the Syncfusion  ASP.NET PowerPoint library convert PowerPoint slide to image in Azure web services using Syncfusion PowerPoint library.:

Steps to convert PowerPoint slide to image in Azure web services using Syncfusion PowerPoint library:

  1. Create a new ASP.NET Web application.

Create a new application in ASP.NET PowerPoint

  1. Select application type as MVC as follows.

Select application type in ASP.NET MVC PowerPoint

  1. ​Install the Syncfusion.Presentation.WinForms NuGet package as a reference to your .NET Framework applications from NuGet.org.

Install NuGet Packages in ASP.NET PowerPoint

 

  1. Add a button in view page by replacing the following design in Views > Home > Index.cshtml.
    @{
        ViewBag.Title = "Home Page";
    }
     
    @{Html.BeginForm("PPTXToImage", "Home", FormMethod.Post);
    {
        <div class="Common">
           <h1>This sample demonstrates how to convert PowerPoint slide to image in Azure Web Services</h1>            
           <input type="submit" class="Button" value="Covert" />
        </div>
        Html.EndForm();
    }
    

 

  1. Add the following code snippet in HomeController class (Controllers -> HomeController.cs) to convert the created PowerPoint slide to image in Azure web services and return the converted image as attachment.
    // [C# Code]
    public ActionResult PPTXToImage()
    {
          //Create a PowerPoint presentation
          IPresentation presentation = Presentation.Create();
          //Add a blank slide to the presentation
          ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
          //Add a text box to the slide
          slide.AddTextBox(450, 100, 300, 300).TextBody.Text = "Hello World";
          //Convert the PowerPoint slide to bitmap image
          Image image = slide.ConvertToImage(Syncfusion.Drawing.ImageType.Bitmap);
          //Create a memory stream to save the image
          MemoryStream imageStream = new MemoryStream();
          //Save the image into memory stream
          image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Jpeg);
          //Dispose the image stream
          image.Dispose();
          //Reset the image stream position
          imageStream.Position = 0;
          //Dispose the presentation instance
          presentation.Dispose();
     
          //Attach the converted image stream into response and post the response
          HttpContext.ApplicationInstance.Response.Clear();
          HttpContext.ApplicationInstance.Response.ContentType = "image/jpeg";
          HttpContext.ApplicationInstance.Response.AddHeader("Content-Disposition", string.Format("attachment; filename=OutputImage.jpg;"));              
          imageStream.CopyTo(HttpContext.ApplicationInstance.Response.OutputStream);
          HttpContext.ApplicationInstance.Response.End();
                
          //Return the index view
          return View("Index");
    }
    

 

  1. Right-click the project and select Publish. Then, create a new profile in the Publish Window.

Publish Window in ASP.NET PowerPoint

  1. Create an App service using Azure subscription and select a hosting plan.

Create App service using Azure in ASP.NET PowerPoint

The Syncfusion Presentation library works from basic hosting plan. So, select the required hosting plan.

Hosting Plan in ASP.NET MVC PowerPoint

  1. After creating the profile, click the Publish button.

Publish Profile in ASP.NET PowerPoint

  1. Now, use the Site URL to launch the hosted Azure Web Service application. You will get the Home Page view as follows.

Launching Application in ASP.NET PowerPoint

  1. Click the Convert button to convert the created PowerPoint slide to image.

 

Converted image can be downloaded from OutputImage.zip.

A complete Azure Web Service sample can be downloaded from AzureWebServiceApp.zip

 

Take a moment to peruse the documentation, where you will find other options like working with PowerPoint tables, working with PowerPoint charts, PowerPoint presentation to image conversion, and PowerPoint presentation to PDF conversion with code examples.

Conclusion

I hope you enjoyed learning about how to convert PowerPoint slide to image in Azure WebServices.

You can refer to our  ASP.NET PowerPoint’s feature tour page to know about its other groundbreaking feature representations. You can also explore our  ASP.NET PowerPoint examples to understand how to present and manipulate data.

For current customers, you can check out our Document Processing Libraries fries from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our ASP.NET PowerPoint and other ASP.NET MVC components.

If you have any queries or require clarifications, please let us know in the comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

 


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied