Getting Started with JavaScript PPTX Editor

14 Nov 20266 minutes to read

JavaScript PPTX Editor enables you to view and print PowerPoint presentations in web applications. This section guides you through the steps to get started and create a PPTX Editor in a JavaScript (ES5) application.

Prerequisites

Create a JavaScript application

Create a folder named pptx-editor-app with index.html and index.js files with the default structure. Your application structure should look like this:

pptx-editor-app/
├── index.html
└── index.js

Add PPTX Editor resources

Add the required PPTX Editor style and script references to the index.html file using one of the following methods:

To use local scripts and styles for the PPTX Editor, follow these steps:

  1. Download and install the PPTX Editor SDK.
  2. Create a resources folder in your application (for example, pptx-editor-app/resources).
  3. From the installed SDK location, copy the required packages from the following folder into the resources folder:
    <Install path>/Syncfusion/Essential Studio/PPTX Editor SDK/35.1.37/Web (Essential JS 2)/JavaScript
    
  4. After copying the files, add the PPTX Editor and its dependent control style and script references at the end of the <head> section in the index.html file.
<!-- PPTX Editor dependent theme -->
<link href="resources/ej2-base/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="resources/ej2-buttons/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="resources/ej2-inputs/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="resources/ej2-popups/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="resources/ej2-lists/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="resources/ej2-navigations/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="resources/ej2-splitbuttons/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="resources/ej2-dropdowns/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<!-- PPTX Editor theme -->
<link href="resources/ej2-pptxeditor/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<!-- PPTX Editor dependent scripts -->
<script src="resources/ej2-base/dist/global/ej2-base.min.js" type="text/javascript"></script>
<script src="resources/ej2-data/dist/global/ej2-data.min.js" type="text/javascript"></script>
<script src="resources/ej2-buttons/dist/global/ej2-buttons.min.js" type="text/javascript"></script>
<script src="resources/ej2-popups/dist/global/ej2-popups.min.js" type="text/javascript"></script>
<script src="resources/ej2-splitbuttons/dist/global/ej2-splitbuttons.min.js" type="text/javascript"></script>
<script src="resources/ej2-inputs/dist/global/ej2-inputs.min.js" type="text/javascript"></script>
<script src="resources/ej2-lists/dist/global/ej2-lists.min.js" type="text/javascript"></script>
<script src="resources/ej2-navigations/dist/global/ej2-navigations.min.js" type="text/javascript"></script>
<script src="resources/ej2-dropdowns/dist/global/ej2-dropdowns.min.js" type="text/javascript"></script>
<script src="resources/ej2-charts/dist/global/ej2-charts.min.js" type="text/javascript"></script>
<script src="resources/ej2-office-chart/dist/global/ej2-office-chart.min.js" type="text/javascript"></script>
<!-- PPTX Editor script -->
<script src="resources/ej2-pptxeditor/dist/global/ej2-pptxeditor.min.js" type="text/javascript"></script>

This example uses the Tailwind 3 theme. To use a different built-in theme, replace the tailwind3.css references with the corresponding theme stylesheets. Refer to the Themes documentation for information about the available themes and the different ways to include theme styles in a JavaScript application. To generate customized resources, refer to the CRG documentation.

Register a Syncfusion License Key

Before initializing the JavaScript (ES5) PPTX Editor control, generate a Syncfusion license key and register it in your application.

Initialize the PPTX Editor

Add a container element in the index.html file and initialize the PPTX Editor in the index.js file.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Syncfusion JavaScript PPTX Editor</title>
    <!-- Add your style references here -->
</head>
<body>
    <!-- Element that renders the PPTX Editor -->
    <div id='pptxEditor'></div>
    <script src="index.js" type="text/javascript"></script>
</body>
</html>

Then, render the editor and load a PowerPoint presentation using the documentPath property.

// Inject the required modules
ej.pptxeditor.PptxEditor.Inject(
    ej.pptxeditor.Toolbar,
    ej.pptxeditor.ThumbnailView,
    ej.pptxeditor.Magnification,
    ej.pptxeditor.Navigation,
    ej.pptxeditor.Print,
    ej.pptxeditor.SlideShow
);

// Initialize PPTX Editor component
var editor = new ej.pptxeditor.PptxEditor({
    theme: 'tailwind3',
    documentPath: 'https://document.syncfusion.com/content/pptxeditor-resources/Sample.pptx'
});

// Render the PPTX Editor
editor.appendTo('#pptxEditor');

Run the application

Open the index.html file in a web browser. The JavaScript (ES5) PPTX Editor is rendered with a toolbar, thumbnail pane, and a slide area.