Skip to content

Getting Started

Installation

bash
npm install pptx-craft

Basic Usage

typescript
import { Presentation } from 'pptx-craft';

const pptx = new Presentation();
const slide = pptx.addSlide();

slide.addText('Hello World', {
  x: 1, y: 1, w: 8, h: 1.5,
  fontSize: 44, color: '003366', bold: true, align: 'center',
});

await pptx.toFile('output.pptx');

How It Works

pptx-craft generates valid Office Open XML (OOXML) files — the same format used by Microsoft PowerPoint. Files are assembled as a ZIP archive containing XML parts, which means:

  • No external dependencies like LibreOffice or PowerPoint
  • Works in Node.js (browser support planned)
  • Generated files open in PowerPoint, LibreOffice, Google Slides, and Keynote

Architecture

The library has three layers:

  1. Builder API — The fluent interface you interact with (Presentation, SlideBuilder)
  2. OOXML Serialization — Element serializers that produce XML fragments, registered in a plugin registry
  3. IO / Packaging — ZIP assembly via fflate

This separation means you can extend the library with custom element types by implementing IElement + IElementSerializer and registering them via a plugin.

Released under the MIT License.