Getting Started with Vue PPTX Editor (Vue 2)

14 Nov 20263 minutes to read

Vue 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 Vue application.

Prerequisites

Create a Vue application

Use Vue CLI to set up a Vue application, as it provides a modular project architecture, flexible configuration, and an integrated plugin system.

Install Vue CLI globally using the following command:

npm install -g @vue/cli

Create a new Vue application using the following command:

vue create quickstart

When creating a new project, you will be prompted to choose a project type. Select the option Default ([Vue 2] babel, eslint).

Move into the created project using the following command:

cd quickstart

Install the PPTX Editor packages

The PPTX Editor package is available in the public npm registry and can be installed directly from npmjs.com.

To install the PPTX Editor component, use the following command:

npm install @syncfusion/ej2-vue-pptxeditor --save

Register a Syncfusion License Key

Before initializing the Vue PPTX Editor control, generate a Syncfusion license key and register it in your application.

Import the required CSS styles

Themes for PPTX Editor can be applied using CSS or SASS files from the npm theme packages, CDN, CRG, or Theme Studio. For more information, see the themes documentation.

This guide uses the Tailwind 3 theme as an example, sourced from the theme package. In this package, each component includes an index.css file that automatically loads all the required dependency styles. To install the Tailwind 3 theme package, use the following command:

npm install @syncfusion/ej2-tailwind3-theme

By default, projects include an src/App.Vue file with default styles. These default styles may conflict with Syncfusion component styles. Clear all content from the <style> section of the App.vue to prevent style conflicts.

The required styles for the PPTX Editor are imported in the <style> section of the src/App.Vue

<style>
@import "@syncfusion/ej2-tailwind-theme/styles/pptxeditor/index.css";
</style>

Initialize the PPTX Editor

Modify the src/App.vue file to render the PPTX Editor. Add the PPTX Editor component in the <template> section using the <ejs-pptxeditor> selector and configure it in the <script> section.

<template>
  <div id="app">
    <ejs-pptxeditor ref="editor" id="container" theme="tailwind3" documentPath="https://document.syncfusion.com/content/pptxeditor-resources/Sample.pptx">
    </ejs-pptxeditor>
  </div>
</template>

<script>
import {
  PptxEditorComponent,
  Toolbar,
  ThumbnailView,
  Magnification,
  Navigation,
  Print,
  SlideShow
} from '@syncfusion/ej2-vue-pptxeditor';

export default {
  name: 'App',
  components: {
    'ejs-pptxeditor': PptxEditorComponent
  },
  provide: {
    pptxeditor: [Toolbar, ThumbnailView, Magnification, Navigation, Print, SlideShow]
  }
};
</script>

<style>
@import "@syncfusion/ej2-tailwind3-theme/styles/pptxeditor/index.css";
</style>

Run the application

Run the application using the following command:

npm run serve

After the application starts, open the localhost URL shown in the terminal. The Vue PPTX Editor is rendered in the browser with a toolbar, thumbnail pane, and a slide area.