Simple Steps to View a PowerPoint Presentation in an ASP.NET Core Application
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (182).NET Core  (28).NET MAUI  (232)Angular  (117)ASP.NET  (49)ASP.NET Core  (81)ASP.NET MVC  (87)Azure  (42)Black Friday Deal  (1)Blazor  (243)BoldSign  (15)DocIO  (24)Essential JS 2  (110)Essential Studio  (201)File Formats  (74)Flutter  (139)JavaScript  (227)Microsoft  (122)PDF  (85)Python  (1)React  (107)Streamlit  (1)Succinctly series  (131)Syncfusion  (989)TypeScript  (33)Uno Platform  (3)UWP  (3)Vue  (46)Webinar  (53)Windows Forms  (59)WinUI  (72)WPF  (164)Xamarin  (159)XlsIO  (38)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (11)Business intelligence  (55)Button  (4)C#  (164)Chart  (153)Chart of the week  (61)Cloud  (16)Company  (440)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (74)Development  (693)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (13)Excel  (43)Extensions  (31)File Manager  (8)Gantt  (22)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (528)Mobile MVC  (9)OLAP server  (2)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (47)Performance  (13)PHP  (2)PivotGrid  (5)Predictive Analytics  (6)Report Server  (3)Reporting  (8)Reporting / Back Office  (9)Rich Text Editor  (12)Road Map  (12)Scheduler  (54)Security  (5)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (32)Solution Services  (4)Spreadsheet  (11)SQL  (15)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (423)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (646)What's new  (354)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Simple Steps to View a PowerPoint Presentation in an ASP.NET Core Application

Simple Steps to View a PowerPoint Presentation in an ASP.NET Core Application

In this blog, we will walk through how to create simple PowerPoint viewer functionality in an ASP.NET Core application using Syncfusion components. The interface will have the following basic options:

  • Browse and open PowerPoint presentation (PPTX) files.
  • Thumbnail view.
  • Print the entire presentation or a specific slide from the browser.
  • Download the PowerPoint presentation as a PDF.
PowerPoint Viewer in ASP.NET Core
PowerPoint Viewer in ASP.NET Core

By integrating PowerPoint viewing capability into your ASP.NET Core application, users can view PowerPoint presentation files without leaving the application or needing any external application. It results in improved security for your PowerPoint files.

We will use Syncfusion’s .NET PowerPoint Library and PDF Viewer control to achieve this functionality. We need to convert a PowerPoint file into a PDF with the former, and then view the resultant PDF using the PDF Viewer:

  • .NET PowerPoint Library: Used to create, read, edit, and convert PPTX files without using Microsoft Office or PowerPoint.
  • PDF Viewer: Used to view, print, and annotate PDF files.

Create eye-catching presentations with the user-friendly features of the Syncfusion PowerPoint Framework!

Design PowerPoint viewer in ASP.NET Core application

Step 1: First, clone the getting started with the PDF Viewer application from the GitHub repository.

Step 2: As we are designing a PowerPoint viewer using the Syncfusion .NET PowerPoint Library and ASP.NET Core PDF Viewer, we must install these NuGet packages in the application:

Note: If you plan to deploy your application to Linux or macOS, install Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux or Syncfusion.EJ2.PdfViewer.AspNet.Core.OSX, respectively, instead of Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows.

Step 3: Open Index.cshtml and set the accept value of the input type as .pptx to accept uploading the PowerPoint presentation files.

<input type=”file” id=”fileUpload” accept=”.pptx” style=”display:block;visibility:hidden;width:0;height:0;”>

Step 4: Modify the onload function script in Index.cshtml like in the following code to load the PowerPoint presentation template as the default instead of the PDF template.

window.onload = function () {
    var pdfViewer = document.getElementById('pdfviewer').ej2_instances[0];
    pdfViewer.serviceUrl = 'api/PowerPointViewer';
    document.getElementById('fileUpload').addEventListener('change', readFile, false);

The features of Syncfusion’s PowerPoint Library are documented with clear code examples for multiple scenarios.

Step 5: In the Controller class, include the following namespaces.

using Syncfusion.Pdf;
using Syncfusion.Presentation;
using Syncfusion.PresentationRenderer;

Step 6: Then, replace the existing code with the following Load() method in the Controller class to convert the PowerPoint presentation to PDF using the .NET PowerPoint Library and send the converted PDF to the PDF Viewer.

public IActionResult Load([FromBody] Dictionary<string, string> jsonObject)
     PdfRenderer pdfviewer = new PdfRenderer(_cache);
     MemoryStream stream = new MemoryStream();
object jsonResult = new object();
if (jsonObject != null && jsonObject.ContainsKey("document")) { if (bool.Parse(jsonObject["isFileName"])) { string documentPath = GetDocumentPath(jsonObject["document"]); if (!string.IsNullOrEmpty(documentPath))
{ byte[] bytes = System.IO.File.ReadAllBytes(documentPath); stream = new MemoryStream(bytes); } else { return this.Content(jsonObject["document"] + " is not found"); } } else { byte[] bytes = Convert.FromBase64String(jsonObject["document"]); stream = new MemoryStream(bytes); } } try { //Open the PowerPoint Presentation using the Syncfusion Presentation library using (IPresentation presentation = Presentation.Open(stream)) { stream.Dispose(); //Convert a PowerPoint Presentation as PDF to view the generated PDF file in our Syncfusion PdfViewer using (PdfDocument pdfDocument = PresentationToPdfConverter.Convert(presentation)) { //Save the converted Pdf document to get a physical DOM of PDF document. stream = new MemoryStream(); pdfDocument.Save(stream); //Reset the pdf stream position. stream.Position = 0; } } } catch { } jsonResult = pdfviewer.Load(stream, jsonObject); return Content(JsonConvert.SerializeObject(jsonResult)); }

Step 7: Now, the application is ready. Launch it and upload the PowerPoint presentation file to display the slides in the PowerPoint viewer.

Syncfusion’s PowerPoint Framework is cross-platform compatible. Explore its features by platform with interactive demos.

GitHub reference

You can find the example of this code in the GitHub repository.

Convert PowerPoint presentations into images

To make the PowerPoint presentation accessible on virtually any platform (Windows, Linux, macOS, mobile, Docker, cloud), you might occasionally want to share or show each slide as an image. Furthermore, it is a handy format to guard against content alteration. Our Syncfusion .NET Core PowerPoint Library provides the APIs to convert an entire PowerPoint presentation or just specific slides to images with just a few lines of code in C# without Microsoft PowerPoint.


Thank you for reading this blog. I hope this information helps you create a PowerPoint viewer using the Syncfusion .NET PowerPoint Library. Take a moment to peruse its documentation, where you’ll find other options and features, all with accompanying code examples.

Our Syncfusion .NET PowerPoint Library has the following significant functionalities:

To learn about all the features supported, please check our product page. If you are new to our PowerPoint Library, it is highly recommended that you follow our Getting Started guide.

Are you already a Syncfusion user? You can download the product setup here. If you’re not a Syncfusion user, you can download a free 30-day trial here.

If you have questions, contact us through our support forumsupport portal, or feedback portal. We are happy to assist you!

Step into a world of boundlessly creative presentations with Syncfusion’s C# PowerPoint Library!

Related blogs


Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed