Saving Presentations
Several methods are available for generating a presentation.
- All methods return a Promise
Saving as a File (writeFile)
Save the presentation as a PowerPoint .pptx file.
- In browser-based apps, this triggers a download using the correct pptx MIME-type.
- In Node.js, it saves to disk via the native fs module.
Write File Props (WriteFileProps)
Write File Example
Generating Other Formats (write)
Generate the presentation in various formats (e.g., base64, arraybuffer) — useful for uploading to cloud storage or handling in-memory.
Write Props (WriteProps)
Write Output Types
Write Example
Streaming in Node.js (stream)
Returns the presentation as a binary string, suitable for streaming in HTTP responses or writing directly to disk in Node.js environments.
Stream Example
Stream the generated file in an HTTP response (shown here with Express):
Saving Multiple Presentations
In the Browser
Each new presentation should use a fresh new PptxGenJS() instance to avoid reusing slides or metadata.