Getting Started with React PPTX Editor
14 Nov 20262 minutes to read
React 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 React application.
Prerequisites
Create a new React application
To set up a React application, run the following commands:
npm create vite@latest pptx-editor-app -- --template react-ts
cd pptx-editor-appnpm create vite@latest pptx-editor-app -- --template react
cd pptx-editor-appInstall the React PPTX Editor npm package
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-react-pptxeditor --saveRegister a Syncfusion License Key
Before initializing the React 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. To install the Tailwind 3 theme package, use the following command:
npm install @syncfusion/ej2-tailwind3-themeBy default, Vite projects include a src/index.css file with default styles. These default styles may conflict with Syncfusion component styles. Clear all content from the src/index.css file to prevent style conflicts.
The required styles for the PPTX Editor are imported in the src/index.css file:
@import "../node_modules/@syncfusion/ej2-tailwind3-theme/styles/pptxeditor/index.css";Initialize the PPTX Editor
Add the PPTX Editor component to your application. Add the following code in src/App.tsx to initialize the component:
import {
PptxEditorComponent,
Toolbar,
ThumbnailView,
Magnification,
Navigation,
Print,
SlideShow,
Inject
} from '@syncfusion/ej2-react-pptxeditor';
function App() {
return (
<div className='control-section'>
<PptxEditorComponent id='container' theme="tailwind3" documentPath='https://document.syncfusion.com/content/pptxeditor-resources/Sample.pptx'>
<Inject services={[Toolbar, ThumbnailView, Magnification, Navigation, Print, SlideShow]} />
</PptxEditorComponent>
</div>
);
}
export default App;Run the application
Run the application using the following command:
npm run devAfter the application starts, open the localhost URL shown in the terminal. The React PPTX Editor is rendered in the browser with a toolbar, thumbnail pane, and a slide area.