Getting Started with ASP.NET Core PPTX Editor

14 Nov 20265 minutes to read

This article provides step-by-step instructions for building an ASP.NET Core application with the Syncfusion® PPTX Editor using Razor Pages and Tag Helpers in Visual Studio and Visual Studio Code. The PPTX Editor enables you to view and print PowerPoint presentations in web applications.

Prerequisites

Create an ASP.NET Core Web App with Razor Pages

Create an ASP.NET Core Web App using Visual Studio via Microsoft Templates or the ASP.NET Core Extension. For detailed instructions, refer to the ASP.NET Core Web App Getting Started documentation.

Run the following commands to create an ASP.NET Core Web App and open the project in Visual Studio Code.

dotnet new webapp -o PptxEditorApp
code -r PptxEditorApp

Alternatively, create an ASP.NET Core Web App using Visual Studio Code via Microsoft Templates, the ASP.NET Core Extension, or the C# Dev Kit extension.

Install the required ASP.NET Core package

Install the Syncfusion.AspNetCore.PptxEditor and Syncfusion.AspNetCore.Themes NuGet packages. See the NuGet packages topic for details about Syncfusion ASP.NET Core packages.

  1. Go to Tools → NuGet Package Manager → Manage NuGet Packages for Solution.
  2. Search for Syncfusion.AspNetCore.PptxEditor and Syncfusion.AspNetCore.Themes and install them.

Alternatively, install the package using the Package Manager Console.

Install-Package Syncfusion.AspNetCore.PptxEditor -Version 35.1.37
Install-Package Syncfusion.AspNetCore.Themes -Version 35.1.37

Open the integrated terminal in the project folder containing the .csproj file and run the following commands.

dotnet add package Syncfusion.AspNetCore.PptxEditor -v 35.1.37
dotnet add package Syncfusion.AspNetCore.Themes -v 35.1.37

Add the ASP.NET Core Tag Helpers

After installing the packages, open ~/Pages/_ViewImports.cshtml and import the Syncfusion.AspNetCore.Base and Syncfusion.AspNetCore.PptxEditor Tag Helpers. Keep the existing Razor Pages imports and Tag Helpers.

@addTagHelper *, Syncfusion.AspNetCore.Base
@addTagHelper *, Syncfusion.AspNetCore.PptxEditor

Register a Syncfusion license key

Before initializing the control, generate a Syncfusion license key and register it in the ASP.NET Core application.

Add stylesheet and script resources

Include the stylesheet and script references inside the <head> of ~/Pages/Shared/_Layout.cshtml. The following example uses the Fluent 2 theme and the resources supplied by the NuGet packages.

<head>
    <!-- Existing head content -->
    <!-- ASP.NET Core controls styles -->
    <link rel="stylesheet" href="_content/Syncfusion.AspNetCore.Themes/styles/fluent2.css" />
    <!-- ASP.NET Core PPTX Editor script -->
    <script src="_content/Syncfusion.AspNetCore.PptxEditor/scripts/sf-pptxeditor.min.js"></script>
</head>

Register the Script Manager

Open the ~/Pages/Shared/_Layout.cshtml file and register the script manager <ejs-scripts> at the end of the <body> element as follows.

<!-- Syncfusion ASP.NET Core Script Manager -->
    <ejs-scripts></ejs-scripts>
</body>

Add the ASP.NET Core PPTX Editor control

Add the ASP.NET Core PptxEditor control in the ~/Pages/Index.cshtml file.

@page
@model IndexModel

<ejs-pptxeditor id="pptxeditor"
                documentPath="https://document.syncfusion.com/content/pptxeditor-resources/Sample.pptx">
</ejs-pptxeditor>

@section Scripts {
    <script>
        ej.pptxeditor.PptxEditor.Inject(ej.pptxeditor.Toolbar, ej.pptxeditor.ThumbnailView, ej.pptxeditor.Magnification, ej.pptxeditor.Navigation, ej.pptxeditor.Print, ej.pptxeditor.SlideShow);
    </script>
}

Run the application

Press Ctrl+F5 (Windows) or ⌘+F5 (macOS) to launch the application. The ASP.NET Core PPTX Editor renders in the default web browser.

Open the integrated terminal in the project folder containing the .csproj file and run the following command.

dotnet run

The page displays the PPTX Editor with a toolbar, a thumbnail pane, and a slide area containing Sample.pptx. Select a thumbnail to navigate to a slide, change the zoom level, start a slideshow, or use the print command.

See also