Loading and Saving in JavaScript PowerPoint
25 Sep 20261 minute to read
The JavaScript PowerPoint Library provides support to open existing presentations, modify their content, and save the result. The library accepts presentation data as Uint8Array from any source (file system, network, or in-memory buffer) and supports saving to the file system.
Opening an existing presentation
Open an existing PowerPoint presentation by passing the Presentation data to the open() function. The function accepts presentation data as a Base64-encoded string or a Uint8Array. The following code example demonstrates how to open a PowerPoint presentation
import { Presentation } from '@syncfusion/ej2-pptx';
// data is a Uint8Array or ArrayBuffer of an .pptx file
// Loads or opens a PowerPoint Presentation.
const pptxDoc = await Presentation.open(data);Save the document
A modified PowerPoint presentation can be saved to the file system by passing the destination path to the save() function. The following code example demonstrates how to save a PowerPoint presentation.
import { Presentation } from '@syncfusion/ej2-pptx';
// Creates a Presentation instance.
const pptxDoc = Presentation.create();
// Adds a slide to the presentation.
pptxDoc.slides.add();
// Saves the Presentation to a file.
await pptxDoc.save('Output.pptx');