Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions File-Formats-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,42 @@
<li>
<a href="/file-formats/Presentation/Presentation-to-image">PPTX to image conversion </a>
<ul>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-Image-in-ASP-NET-Core">ASP.NET Core</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-Image-in-ASP-NET-MVC">ASP.NET MVC</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-Image-in-ASP-Net">ASP.NET</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-Image-in-Blazor">Blazor</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-Image-in-Xamarin">Xamarin</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-Image-in-Windows-Forms">Windows Forms</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-Image-in-WPF">WPF</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-Image-in-UWP">UWP</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-Image-in-WinUI">WinUI</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-Image-in-MAUI">.NET MAUI</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-Image-in-Linux">Linux</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-Image-in-Mac">Mac</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-Image-in-Azure">Azure</a>
<ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
title: Convert PowerPoint to Image in ASP.NET Core | Syncfusion
description: Convert PowerPoint to image in ASP.NET Core using .NET Core PowerPoint library (Presentation) without Microsoft PowerPoint or interop dependencies.
platform: file-formats
control: PowerPoint
documentation: UG
---

# Convert PowerPoint to Image in ASP.NET Core

Syncfusion PowerPoint is a [.NET Core PowerPoint library](https://www.syncfusion.com/document-processing/powerpoint-framework/net-core) used to create, read, edit and **convert PowerPoint presentation** programmatically without **Microsoft PowerPoint** or interop dependencies. Using this library, you can **convert a PowerPoint to image in ASP.NET Core**.

## Steps to convert PowerPoint to Image programmatically

Step 1: Create a new C# ASP.NET Core web application project.

![Create ASP.NET Core Web project for PowerPoint file](Workingwith_Core/Create-Project-Open-and-Save.png)

Step 2: Install the [Syncfusion.PresentationRenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.PresentationRenderer.Net.Core) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/).

![Install Syncfusion.PresentationRenderer.Net.Core Nuget Package](Azure_Images/App_Service_Linux/Nuget_Package_PowerPoint_Presentation_to_PDF.png)

N> Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion license key in your application to use our components.
Step 3: Include the following namespaces in **HomeController.cs**.

{% tabs %}
{% highlight c# tabtitle="C#" %}

using Syncfusion.Presentation;
using Syncfusion.PresentationRenderer;

{% endhighlight %}
{% endtabs %}

Step 4: A default action method named Index will be present in **HomeController.cs**. Right click on Index method and select **Go To View** where you will be directed to its associated view page **Index.cshtml**.

Step 5: Add a new button in the **Index.cshtml** as shown below.

{% tabs %}
{% highlight HTML %}

@{
Html.BeginForm("ConvertPPTXtoImage", "Home", FormMethod.Get);
{
<div>
<input type="submit" value="Convert PPTX to Image" style="width:200px;height:27px" />
</div>
}
Html.EndForm();
}

{% endhighlight %}
{% endtabs %}

Step 6: Add a new action method **ConvertPPTXtoImage** in HomeController.cs and include the below code snippet to **convert a PowerPoint to image in ASP.NET Core**.

{% tabs %}
{% highlight c# tabtitle="C#" %}

//Open the file as Stream.
using (FileStream fileStream = new FileStream(Data/Input.pptx", FileMode.Open, FileAccess.Read))
{
//Open the existing PowerPoint presentation.
using (IPresentation pptxDoc = Presentation.Open(fileStream))
{
//Initialize the PresentationRenderer to perform image conversion.
pptxDoc.PresentationRenderer = new PresentationRenderer();
//Convert PowerPoint slide to image as stream.
Stream stream = pptxDoc.Slides[0].ConvertToImage(ExportImageFormat.Jpeg);
//Reset the stream position.
stream.Position = 0;
//Download image in the browser.
return File(stream, "application/jpeg", "PPTXtoImage.Jpeg");
}
}

{% endhighlight %}
{% endtabs %}

You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/PPTX-to-Image-conversion/Convert-PowerPoint-presentation-to-Image/ASP.NET-Core).

By executing the program, you will get the **image** as follows.

![PowerPoint to Image in ASP.NET Core](PPTXtoPDF_images/Output_PowerPoint_Presentation_to-Image.png)

Click [here](https://www.syncfusion.com/document-processing/powerpoint-framework/net-core) to explore the rich set of Syncfusion PowerPoint Library (Presentation) features.

An online sample link to [convert PowerPoint Presentation to image](https://ej2.syncfusion.com/aspnetcore/PowerPoint/PPTXToImage#/material3) in ASP.NET Core.
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
title: Convert PowerPoint to Image in ASP.NET MVC | Syncfusion
description: Convert PowerPoint to image in ASP.NET MVC using .NET PowerPoint library (Presentation) without Microsoft PowerPoint or interop dependencies.
platform: file-formats
control: PowerPoint
documentation: UG
---

# Convert PowerPoint to Image in ASP.NET MVC

Syncfusion PowerPoint is a [.NET PowerPoint library](https://www.syncfusion.com/document-processing/powerpoint-framework/net) used to create, read, edit and convert PowerPoint presentation programmatically without **Microsoft PowerPoint** or interop dependencies. Using this library, you can **convert a PowerPoint to image in ASP.NET MVC**.

## Steps to convert PowerPoint to Image programmatically

Step 1: Create a new C# ASP.NET MVC application project.

![Create ASP.NET MVC project](Workingwith_MVC/Project-Open-and-Save.png)

Step 2: Select the **MVC** template to create the project.

![Select MVC template](Workingwith_MVC/MVC-Open-and-Save.png)

Step 3: Install the [Syncfusion.Presentation.AspNet.Mvc5](https://www.nuget.org/packages/Syncfusion.Presentation.AspNet.Mvc5) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/).

![Install Syncfusion.Presentation.AspNet.Mvc5 Nuget Package](Workingwith_MVC/Nuget-Package-PPTXtoImage.png)

N> Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion license key in your application to use our components.

Step 4: Include the following namespace in that **HomeController.cs** file.

{% tabs %}
{% highlight c# tabtitle="C#" %}

using Syncfusion.Presentation;

{% endhighlight %}
{% endtabs %}

Step 5: A default action method named **Index** will be present in HomeController.cs. Right click on this action method and select **Go To View** where you will be directed to its associated view page **Index.cshtml**.

Step 6: Add a new button in the Index.cshtml as shown below.

{% tabs %}
{% highlight HTML %}

@{
Html.BeginForm("ConvertPPTXtoImage", "Home", FormMethod.Get);
{
<div>
<input type="submit" value="Convert PPTX to Image" style="width:200px;height:27px" />
</div>
}
Html.EndForm();
}

{% endhighlight %}
{% endtabs %}

Step 7: Add the below code snippet in **HomeController.cs** to **convert a PowerPoint to image in ASP.NET MVC**.

{% tabs %}
{% highlight c# tabtitle="C#" %}

public void ConvertPPTXtoImage()
{
//Open the file as Stream.
using (FileStream pathStream = new FileStream(Server.MapPath("~/App_Data/Input.pptx"), FileMode.Open, FileAccess.Read))
{
//Opens a PowerPoint Presentation.
using (IPresentation pptxDoc = Presentation.Open(pathStream))
{
//Convert the first slide into image.
Image image = pptxDoc.Slides[0].ConvertToImage(Syncfusion.Drawing.ImageType.Metafile);
//Saves the image file to MemoryStream.
MemoryStream stream = new MemoryStream();
//Download image file in the browser.
ExportAsImage(image, "PPTXToImage.Jpeg", ImageFormat.Jpeg, HttpContext.ApplicationInstance.Response);
}
}
}
//To download the image file.
protected void ExportAsImage(Image image, string fileName, ImageFormat imageFormat, HttpResponse response)
{
if (ControllerContext == null)
throw new ArgumentNullException("Context");
string disposition = "content-disposition";
response.AddHeader(disposition, "attachment; filename=" + fileName);
if (imageFormat != ImageFormat.Emf)
image.Save(response.OutputStream, imageFormat);
Response.End();
}

{% endhighlight %}
{% endtabs %}

You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/PPTX-to-Image-conversion/Convert-PowerPoint-presentation-to-Image/ASP.NET-MVC).

By executing the program, you will get the **image** as follows.

![PowerPoint to Image in ASP.NET MVC](PPTXtoPDF_images/Output_PowerPoint_Presentation_to-Image.png)

Click [here](https://www.syncfusion.com/document-processing/powerpoint-framework/net) to explore the rich set of Syncfusion PowerPoint Library (Presentation) features.

An online sample link to [convert PowerPoint Presentation to image](https://ej2.syncfusion.com/aspnetmvc/PowerPoint/PPTXToImage#/material3) in ASP.NET MVC.
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
title: Convert PowerPoint to Image in ASP.NET | Syncfusion
description: Convert PowerPoint to image in ASP.NET using .NET PowerPoint library (Presentation) without Microsoft PowerPoint or interop dependencies.
platform: file-formats
control: PowerPoint
documentation: UG
---

# Convert PowerPoint to Image in ASP.NET

Syncfusion PowerPoint is a [.NET PowerPoint library](https://www.syncfusion.com/document-processing/powerpoint-framework/net) used to create, read, edit and **convert PowerPoint presentation** programmatically without **Microsoft PowerPoint** or interop dependencies. Using this library, you can **convert a PowerPoint to image in ASP.NET**.

## Steps to convert PowerPoint to Image programmatically

Step 1: Create a new C# ASP.NET web application project.

![Create ASP.NET Web project](Workingwith_Web/Project-Open-and-Save.png)

Step 2: Select the **Empty** template to create the project.

![Select Web Forms template](Workingwith_Web/Empty-Open-and-Save.png)

Step 3: Install the [Syncfusion.PresentationRenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.PresentationRenderer.Net.Core) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/).

![Install Syncfusion.PresentationRenderer.Net.Core Nuget package](Azure_Images/App_Service_Linux/Nuget_Package_PowerPoint_Presentation_to_PDF.png)

N> Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion license key in your application to use our components.

Step 4: Include the following namespaces in **MainPage.aspx.cs**.

{% tabs %}
{% highlight c# tabtitle="C#" %}

using Syncfusion.Presentation;
using Syncfusion.PresentationRenderer;

{% endhighlight %}
{% endtabs %}

Step 5: Add a new button in the **MainPage.aspx** as shown below.

{% tabs %}
{% highlight HTML %}

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainPage.aspx.cs" Inherits="Convert_PowerPoint_Presentation_to_Image.WebForm1" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Convert PPTX to Image" OnClick="OnButtonClicked" />
</div>
</form>
</body>
</html>

{% endhighlight %}
{% endtabs %}

Step 6: Include the below code snippets in **MainPage.aspx.cs** to **convert a PowerPoint to image in ASP.NET**.

{% tabs %}
{% highlight c# tabtitle="C#" %}

string filePath = Server.MapPath("~/App_Data/Input.pptx");
//Open the existing PowerPoint presentation.
using (IPresentation pptxDoc = Presentation.Open(filePath))
{
//Initialize the PresentationRenderer.
pptxDoc.PresentationRenderer = new PresentationRenderer();
//Converts the first slide into image.
using (Stream stream = pptxDoc.Slides[0].ConvertToImage(ExportImageFormat.Jpeg))
{
//Create the output image file stream.
using (FileStream fileStreamOutput = File.Create(Server.MapPath("~/PPTXtoImage.Jpeg")))
{
//Copy the converted image stream into created output image stream.
stream.CopyTo(fileStreamOutput);
}
}
}

{% endhighlight %}
{% endtabs %}

You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/PPTX-to-Image-conversion/Convert-PowerPoint-presentation-to-Image/ASP.NET).

By executing the program, you will get the **image** as follows.

![PowerPoint to Image in ASP.NET](PPTXtoPDF_images/Output_PowerPoint_Presentation_to-Image.png)

Click [here](https://www.syncfusion.com/document-processing/powerpoint-framework/net) to explore the rich set of Syncfusion PowerPoint Library (Presentation) features.

An online sample link to [convert PowerPoint Presentation to image](https://ej2.syncfusion.com/aspnetcore/PowerPoint/PPTXToImage#/material3) in ASP.NET Core.
Loading