PPTX
Quick Start
Create your first PowerPoint presentation in 5 minutes
Get started with @office-open/pptx by creating a simple multi-slide presentation.
Installation
pnpm add @office-open/pptx
npm install @office-open/pptx
yarn add @office-open/pptx
bun add @office-open/pptx
Step 1 — Create a Presentation
{
"title": "My First Presentation",
"creator": "Author",
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "2.6cm",
"width": "21.2cm",
"height": "9.3cm",
"textBody": {
"text": "Hello, PowerPoint!",
"children": [
{
"properties": { "alignment": "CENTER" },
"children": [
{
"text": "My First Presentation",
"size": 40,
"bold": true,
"fill": "4472C4"
}
]
}
]
}
}
}
]
}
]
}
import { generatePresentation } from "@office-open/pptx";
const buffer = await generatePresentation({
title: "My First Presentation",
creator: "Author",
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "2.6cm",
width: "21.2cm",
height: "9.3cm",
textBody: {
text: "Hello, PowerPoint!",
children: [
{
properties: { alignment: "CENTER" },
children: [
{
text: "My First Presentation",
size: 40,
bold: true,
fill: "4472C4",
},
],
},
],
},
},
},
],
},
],
});
Step 2 — Add Multiple Slides
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "4.0cm",
"width": "21.2cm",
"height": "5.3cm",
"textBody": {
"text": "Quarterly Report",
"children": [
{
"properties": { "alignment": "CENTER" },
"children": [{ "text": "Q4 2025 Summary", "size": 44, "bold": true }]
},
{
"properties": { "alignment": "CENTER" },
"children": [
{
"text": "Prepared by the Finance Team",
"size": 20,
"fill": "808080"
}
]
}
]
}
}
}
]
},
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "23.3cm",
"height": "2.6cm",
"textBody": {
"text": "Key Highlights",
"children": [
{
"children": [{ "text": "Key Highlights", "size": 28, "bold": true }]
}
]
}
}
},
{
"shape": {
"x": "1.3cm",
"y": "2.6cm",
"width": "23.3cm",
"height": "9.3cm",
"textBody": {
"children": [
{
"properties": { "bullet": { "type": "char", "char": "●" } },
"children": [
{
"text": "Revenue grew by 15% year-over-year",
"size": 18
}
]
},
{
"properties": { "bullet": { "type": "char", "char": "●" } },
"children": [
{
"text": "Customer satisfaction reached 94%",
"size": 18
}
]
},
{
"properties": { "bullet": { "type": "char", "char": "●" } },
"children": [{ "text": "Expanded into 3 new markets", "size": 18 }]
}
]
}
}
}
]
}
]
}
import { generatePresentation } from "@office-open/pptx";
const buffer = await generatePresentation({
slides: [
// Title slide
{
children: [
{
shape: {
x: "1.3cm",
y: "4.0cm",
width: "21.2cm",
height: "5.3cm",
textBody: {
text: "Quarterly Report",
children: [
{
properties: { alignment: "CENTER" },
children: [{ text: "Q4 2025 Summary", size: 44, bold: true }],
},
{
properties: { alignment: "CENTER" },
children: [
{
text: "Prepared by the Finance Team",
size: 20,
fill: "808080",
},
],
},
],
},
},
},
],
},
// Content slide
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "23.3cm",
height: "2.6cm",
textBody: {
text: "Key Highlights",
children: [
{
children: [{ text: "Key Highlights", size: 28, bold: true }],
},
],
},
},
},
{
shape: {
x: "1.3cm",
y: "2.6cm",
width: "23.3cm",
height: "9.3cm",
textBody: {
children: [
{
properties: { bullet: { type: "char", char: "●" } },
children: [
{
text: "Revenue grew by 15% year-over-year",
size: 18,
},
],
},
{
properties: { bullet: { type: "char", char: "●" } },
children: [
{
text: "Customer satisfaction reached 94%",
size: 18,
},
],
},
{
properties: { bullet: { type: "char", char: "●" } },
children: [{ text: "Expanded into 3 new markets", size: 18 }],
},
],
},
},
},
],
},
],
});
Step 3 — Export the File
Node.js — Write to file
import fs from "node:fs";
import { generatePresentation } from "@office-open/pptx";
const buffer = await generatePresentation({
/* options */
});
fs.writeFileSync("presentation.pptx", buffer);
console.log("Created presentation.pptx");
Browser — Download
import { generatePresentation } from "@office-open/pptx";
const blob = await generatePresentation(
{
/* options */
},
{ type: "blob" },
);
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "presentation.pptx";
a.click();
URL.revokeObjectURL(url);
Step 4 — Run It
Save the code to a file (e.g., demo.ts) and run:
npx tsx demo.ts