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 @@ -1004,6 +1004,42 @@
<li>
<a href="/file-formats/Presentation/Presentation-to-PDF">PPTX to PDF conversion</a>
<ul>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-PDF-in-ASP-NET-Core">ASP.NET Core</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-PDF-in-ASP-NET-MVC">ASP.NET MVC</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-PDF-in-ASP-Net">ASP.NET</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-PDF-in-Blazor">Blazor</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-PDF-in-Xamarin">Xamarin</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-PDF-in-Windows-Forms">Windows Forms</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-PDF-in-WPF">WPF</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-PDF-in-UWP">UWP</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-PDF-in-WinUI">WinUI</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-PDF-in-MAUI">.NET MAUI</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-PDF-in-Linux">Linux</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-PDF-in-Mac">Mac</a>
</li>
<li>
<a href="/file-formats/Presentation/Convert-PowerPoint-Presentation-to-PDF-in-Azure">Azure</a>
<ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
title: Convert PowerPoint to PDF in ASP.NET Core | Syncfusion
description: Convert PowerPoint to PDF 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 PDF 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 PDF in ASP.NET Core**.

## Steps to convert PowerPoint to PDF 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;
using Syncfusion.Pdf;

{% 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("ConvertPPTXtoPDF", "Home", FormMethod.Get);
{
<div>
<input type="submit" value="Convert PPTX to PDF" style="width:200px;height:27px" />
</div>
}
Html.EndForm();
}

{% endhighlight %}
{% endtabs %}

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

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

//Open the file as Stream
using (FileStream fileStream = new FileStream(Path.GetFullPath("Data/Input.pptx"), FileMode.Open, FileAccess.Read))
{
//Open the existing PowerPoint presentation with loaded stream.
using (IPresentation pptxDoc = Presentation.Open(fileStream))
{
//Convert the PowerPoint presentation to PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Create the MemoryStream to save the converted PDF.
MemoryStream pdfStream = new MemoryStream();
//Save the converted PDF document to MemoryStream.
pdfDocument.Save(pdfStream);
pdfStream.Position = 0;
//Download PDF document in the browser.
return File(pdfStream, "application/pdf", "Sample.pdf");
}
}
}

{% endhighlight %}
{% endtabs %}

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

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

![Converted PDF from PowerPoint in ASP.NET Core](PPTXtoPDF_images/Output_PowerPoint_Presentation_to-PDF.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 PDF](https://ej2.syncfusion.com/aspnetcore/PowerPoint/PPTXToPDF#/material3) in ASP.NET Core.
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
title: Convert PowerPoint to PDF in ASP.NET MVC | Syncfusion
description: Convert PowerPoint to PDF 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 PDF 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 PDF in ASP.NET MVC**.

## Steps to convert PowerPoint to PDF 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.PresentationToPdfConverter.AspNet.Mvc5](https://www.nuget.org/packages/Syncfusion.PresentationToPdfConverter.AspNet.Mvc5) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org/).

![Install Syncfusion.PresentationToPdfConverter.AspNet.Mvc5 Nuget Package](Workingwith_MVC/Nuget-Open-and-Save.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;
using Syncfusion.PresentationToPdfConverter;
using Syncfusion.Pdf;

{% 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("ConvertPPTXtoPDF", "Home", FormMethod.Get);
{
<br />
<div>
<input type="submit" value="Convert PPTX to PDF" style="width:200px;height:27px" />
</div>
}
Html.EndForm();
}

{% endhighlight %}
{% endtabs %}

Step 7: Add a new action method **ConvertPPTXtoPDF** in HomeController.cs and include the below code snippet to **convert a PowerPoint to PDF in ASP.NET MVC**.

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

//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))
{
//Converts the PowerPoint Presentation into PDF document
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Saves the PDF document to MemoryStream.
MemoryStream stream = new MemoryStream();
pdfDocument.Save(stream);
stream.Position = 0;
//Download PDF document in the browser.
return File(stream, "application/pdf", "Sample.pdf");
}
}
}

{% endhighlight %}
{% endtabs %}

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

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

![Converted PDF from PowerPoint in ASP.NET MVC](PPTXtoPDF_images/Output_PowerPoint_Presentation_to-PDF.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 PDF](https://ej2.syncfusion.com/aspnetmvc/PowerPoint/PPTXToPdf#/material3) in ASP.NET MVC
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
title: Convert PowerPoint to PDF in ASP.NET | Syncfusion
description: Convert PowerPoint to PDF in ASP.NET using .NET PowerPoint library (Presentation) without Microsoft PowerPoint or interop dependencies.
platform: file-formats
control: PowerPoint
documentation: UG
---

# Convert PowerPoint to PDF 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 PDF in ASP.NET**.

## Steps to convert PowerPoint to PDF 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.Pdf;
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_PDF.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 PDF" OnClick="OnButtonClicked" />
</div>
</form>
</body>
</html>

{% endhighlight %}
{% endtabs %}

Step 6: Include the below code snippets in the click event of the button in **MainPage.aspx.cs**, to **convert a PowerPoint to PDF 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))
{
//Create the MemoryStream to save the converted PDF.
using (MemoryStream pdfStream = new MemoryStream())
{
//Convert the PowerPoint presentation to PDF document.
using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc))
{
//Save the converted PDF document to MemoryStream.
pdfDocument.Save(pdfStream);
pdfStream.Position = 0;
}
//Create the output PDF file stream.
using (FileStream fileStreamOutput = File.Create(Server.MapPath("~/Sample.pdf")))
{
//Copy the converted PDF stream into created output PDF stream.
pdfStream.CopyTo(fileStreamOutput);
}
}
}

{% endhighlight %}
{% endtabs %}

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

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

![Converted PDF from PowerPoint in ASP.NET](PPTXtoPDF_images/Output_PowerPoint_Presentation_to-PDF.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 PDF](https://ej2.syncfusion.com/aspnetcore/PowerPoint/PPTXToPDF#/material3) in ASP.NET Core.
Loading