Installation Guide
Installation & Project Setup
Install `node-pptx-templater` via your favorite package manager. Ships with dual ESM/CJS builds and native TypeScript declarations.
Package Installation
npm
bash
npm install node-pptx-templaterpnpm
bash
pnpm add node-pptx-templateryarn
bash
yarn add node-pptx-templaterbun
bash
bun add node-pptx-templaterPrerequisites & System Requirements
Node.js Version: >= 18.0.0 (Recommended: >= 20.12.0)
Runs on modern V8 JavaScript runtimes. Fully compatible with Node 18, 20, 22, 24, AWS Lambda, Cloudflare Workers, and Bun.
Zero Microsoft Office or Native Addons Required
No `node-gyp`, no Python build toolchains, no LibreOffice, and no Java JDK required. Pure JavaScript AST and ZIP parsing.
Module Configuration
1. Modern ECMAScript Modules (ESM)
index.mjs
// Using ECMAScript Modules (ESM)
import { PPTXTemplater } from 'node-pptx-templater';
const ppt = await PPTXTemplater.load('./template.pptx');
ppt.useSlide(1).replaceText({ '{{USER}}': 'Sarah Connor' });
await ppt.saveToFile('./output.pptx');2. CommonJS (CJS)
index.js
// Using CommonJS (CJS)
const { PPTXTemplater } = require('node-pptx-templater');
async function run() {
const ppt = await PPTXTemplater.load('./template.pptx');
ppt.useSlide(1).replaceText({ '{{USER}}': 'Sarah Connor' });
await ppt.saveToFile('./output.pptx');
}
run();3. TypeScript Support
TypeScript definitions (`index.d.ts`) are bundled directly with the package. No `@types/node-pptx-templater` installation is needed.
report.ts
// TypeScript with native autocompletion and types
import { PPTXTemplater, PPTXSlide, ReplaceTextOptions } from 'node-pptx-templater';
async function generateDeck(): Promise<Buffer> {
const ppt = await PPTXTemplater.load('./deck.pptx');
const slide: PPTXSlide = ppt.useSlide(1);
slide.replaceText({ '{{METRIC}}': '99.98%' }, { caseSensitive: true });
return await ppt.toBuffer();
}Next Step
Compatibility MatrixReview Runtime Compatibility & Serverless