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.jsAdd 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:
- Download and install the PPTX Editor SDK.
- Create a
resourcesfolder in your application (for example,pptx-editor-app/resources). - From the installed SDK location, copy the required packages from the following folder into the
resourcesfolder:<Install path>/Syncfusion/Essential Studio/PPTX Editor SDK/35.1.37/Web (Essential JS 2)/JavaScript - 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.htmlfile.
<!-- 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>Reference the scripts and styles directly from the CDN and add at the end of the <head> section in the index.html file.
Script: https://cdn.syncfusion.com/ej2/35.1.37/{PACKAGE_NAME}/dist/global/{PACKAGE_NAME}.min.js
Style: https://cdn.syncfusion.com/ej2/35.1.37/{PACKAGE_NAME}/styles/{THEME_NAME}.css
<!-- PPTX Editor dependent theme -->
<link href="https://cdn.syncfusion.com/ej2/35.1.37/ej2-base/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.syncfusion.com/ej2/35.1.37/ej2-buttons/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.syncfusion.com/ej2/35.1.37/ej2-inputs/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.syncfusion.com/ej2/35.1.37/ej2-popups/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.syncfusion.com/ej2/35.1.37/ej2-lists/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.syncfusion.com/ej2/35.1.37/ej2-navigations/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.syncfusion.com/ej2/35.1.37/ej2-splitbuttons/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.syncfusion.com/ej2/35.1.37/ej2-dropdowns/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<!-- PPTX Editor theme -->
<link href="https://cdn.syncfusion.com/ej2/35.1.37/ej2-pptxeditor/styles/tailwind3.css" rel="stylesheet" type="text/css" />
<!-- PPTX Editor dependent scripts -->
<script src="https://cdn.syncfusion.com/ej2/35.1.37/ej2-base/dist/global/ej2-base.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/35.1.37/ej2-buttons/dist/global/ej2-buttons.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/35.1.37/ej2-popups/dist/global/ej2-popups.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/35.1.37/ej2-splitbuttons/dist/global/ej2-splitbuttons.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/35.1.37/ej2-inputs/dist/global/ej2-inputs.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/35.1.37/ej2-lists/dist/global/ej2-lists.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/35.1.37/ej2-navigations/dist/global/ej2-navigations.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/35.1.37/ej2-dropdowns/dist/global/ej2-dropdowns.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/35.1.37/ej2-charts/dist/global/ej2-charts.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/35.1.37/ej2-office-chart/dist/global/ej2-office-chart.min.js" type="text/javascript"></script>
<!-- PPTX Editor script -->
<script src="https://cdn.syncfusion.com/ej2/35.1.37/ej2-pptxeditor/dist/global/ej2-pptxeditor.min.js" type="text/javascript"></script>This example uses the
Tailwind 3theme. To use a different built-in theme, replace thetailwind3.cssreferences 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.