Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@office-open/pptx

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@office-open/pptx

Generate, parse, and patch .pptx presentations with a declarative TypeScript API

edge
latest
Source
npmnpm
Version
0.8.1
Version published
Weekly downloads
474
-72.25%
Maintainers
1
Weekly downloads
 
Created
Source

@office-open/pptx

Generate and parse .pptx presentations with a declarative TypeScript API. Works in Node.js and browsers.

Features

  • 🖥️ Slide Management — Create presentations with multiple slides, slide masters, and slide layouts
  • 🔷 Shapes — Rectangles, ellipses, lines, connectors, and custom geometry shapes
  • ✍️ Text & Rich Formatting — Paragraphs, runs, fonts, colors, alignment, and spacing
  • 📊 Tables — Full table support with rows, cells, borders, and cell properties
  • 📈 Charts — Bar, line, pie, area, and scatter charts with customization
  • 🧩 SmartArt — Built-in SmartArt graphic generation with multiple layouts and styles
  • 🖼️ Images — Inline pictures with fills, transformations, and effects
  • 🎨 Backgrounds — Solid color, gradient, and picture backgrounds
  • 🔄 Transitions — Slide transitions with various types and durations
  • Animations — Entrance, emphasis, exit, and motion path animations
  • 🎬 Media — Video and audio embedding
  • 🔗 Hyperlinks — Clickable hyperlinks on shapes and text
  • 📑 Headers & Footers — Slide header/footer with date, slide number
  • 📝 Notes — Speaker notes for each slide
  • 👥 Group Shapes — Group multiple shapes together
  • 🖌️ DrawingML — Shapes with fills, outlines, shadows, glow, reflection, and 3D effects
  • 📖 Parsing — Parse existing .pptx files with parsePresentation for round-trip workflows
  • 🔧 Template Patching — Patch existing PPTX templates via placeholder replacement

Installation

# pnpm
pnpm add @office-open/pptx

# npm
npm install @office-open/pptx

# yarn
yarn add @office-open/pptx

# bun
bun add @office-open/pptx

Quick Start

import { Presentation, Shape, Packer, Paragraph, TextRun } from "@office-open/pptx";
import { writeFileSync } from "node:fs";

const pres = new Presentation({
  slides: [
    {
      children: [
        new Shape({
          textBody: { children: [new Paragraph({ children: [new TextRun("Hello World")] })] },
          fill: "4472C4",
          x: 100,
          y: 100,
          width: 600,
          height: 400,
        }),
      ],
    },
  ],
});

const buffer = await Packer.toBuffer(pres);
writeFileSync("presentation.pptx", buffer);

Parsing

Read existing .pptx files and re-create them as PresentationOptions:

import { parsePresentation, Presentation, Packer } from "@office-open/pptx";
import { readFileSync, writeFileSync } from "node:fs";

const opts = parsePresentation(new Uint8Array(readFileSync("input.pptx")));

// Modify parsed data, then re-generate
const pres = new Presentation(opts);
const buffer = await Packer.toBuffer(pres);
writeFileSync("output.pptx", buffer);

Benchmark

Performance vs PptxGenJS (higher ops/s is better, Windows 11 / Node 24).

Default = XML DEFLATE level 1 (SuperFast, matching MS Office) + media STORE. All STORE = no compression ({ compression: { xml: 0 } }). PptxGenJS (async only) defaults to STORE (via JSZip), supports DEFLATE via compression: true (applies to ALL entries including images).

// Default (matches MS Office)
await Packer.toBuffer(pres);
// All STORE (no compression)
await Packer.toBuffer(pres, { compression: { xml: 0 } });

Create + toBuffer (end-to-end)

ScenarioDefault syncDefault asyncAll STORE syncAll STORE asyncPptxGenJS
Simple (2 shapes)1,154 ops/s561 ops/s2,788 ops/s2,236 ops/s176 ops/s
Styled shapes (20)944 ops/s563 ops/s2,274 ops/s2,379 ops/s143 ops/s
Table (10x5)1,747 ops/s659 ops/s5,305 ops/s5,196 ops/s659 ops/s
Full featured762 ops/s482 ops/s1,605 ops/s1,451 ops/s75 ops/s

Large Files — Create + toBuffer

ScenarioDefault syncDefault asyncAll STORE syncAll STORE asyncPptxGenJS
30 slides x 20 shapes133 ops/s85 ops/s211 ops/s242 ops/s91 ops/s
30 slides x 10 images10.1 ops/s9.88 ops/s10.2 ops/s10.1 ops/s0.35 ops/s
100x10 table502 ops/s369 ops/s698 ops/s704 ops/s119 ops/s
50 slides full25.1 ops/s20.3 ops/s26.9 ops/s26.1 ops/s1.02 ops/s

Large File (~100MB) — Mixed Content

40 slides x (2 shapes + 2 mixed-size images + 3x3 table). Speedup is vs PptxGenJS.

MethodSpeedSpeedup
Default8.0 ops/s26.7x
All STORE8.2 ops/s27.4x
PptxGenJS0.30 ops/s

Examples

Check the demo folder for working examples covering every feature.

License

Keywords

office-open

FAQs

Package last updated on 06 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts