PPTX

Slide Layout

Configure slide size, background, and speaker notes

Control the dimensions, background, and notes for each slide.

Slide Dimensions

Set slide size using the size property in the presentation options:

{
  "size": { "width": "33.9cm", "height": "19.1cm" },
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "2.6cm",
            "y": "2.6cm",
            "width": "21.2cm",
            "height": "10.6cm",
            "textBody": { "text": "Widescreen content" }
          }
        }
      ]
    }
  ]
}

Size Presets

Use string shortcuts for common aspect ratios:

import { generatePresentation } from "@office-open/pptx";

generatePresentation({
  size: "16:9", // or "4:3"
  slides: [],
});
PresetDimensions (EMU)Pixels (96 DPI)
"16:9"12192000 x 68580001280 x 720
"4:3"9144000 x 6858000960 x 720

Hidden Slides

Exclude a slide from the slide show with hidden: true (emits p:sld/@show="0"):

import { generatePresentation } from "@office-open/pptx";

generatePresentation({
  slides: [
    { children: [], hidden: true }, // skipped during presentation
    { children: [] },
  ],
});

Slide Background

Solid Color

{
  "slides": [
    {
      "children": [],
      "background": { "fill": "1F4E79" }
    }
  ]
}

Gradient

{
  "slides": [
    {
      "children": [],
      "background": {
        "fill": {
          "type": "gradient",
          "stops": [
            { "position": 0, "color": "0D47A1" },
            { "position": 100, "color": "1976D2" }
          ],
          "angle": 90
        }
      }
    }
  ]
}

Image Background

import * as fs from "node:fs";
import { generatePresentation } from "@office-open/pptx";

generatePresentation({
  slides: [
    {
      background: {
        fill: {
          type: "blip",
          data: new Uint8Array(fs.readFileSync("bg.png")),
          imageType: "png",
        },
      },
      children: [],
    },
  ],
});

Speaker Notes

Add notes visible in presenter mode:

{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "2.6cm",
            "y": "2.6cm",
            "width": "21.2cm",
            "height": "10.6cm",
            "textBody": { "text": "Slide content" }
          }
        }
      ],
      "notes": "Remember to emphasize the key metrics in this slide."
    }
  ]
}

Presentation Metadata

import { generatePresentation } from "@office-open/pptx";

generatePresentation({
  title: "Annual Report 2025",
  creator: "John Doe",
  description: "Yearly financial summary",
  subject: "Finance",
  keywords: "annual, report, finance",
  lastModifiedBy: "Jane Doe",
  revision: 1,
  slides: [],
});

Metadata Properties

PropertyTypeDescription
titlestringDocument title
creatorstringAuthor name
descriptionstringDocument description
subjectstringSubject
keywordsstringKeywords
lastModifiedBystringLast modifier name
revisionnumberRevision number

Slide Master

Define slide masters using the masters property. Each master can customize its theme, background, and placeholder layout:

import { generatePresentation } from "@office-open/pptx";

generatePresentation({
  masters: [
    {
      name: "light",
      background: { fill: "FFFFFF" },
      theme: {
        name: "Light Theme",
        colors: { dark1: "333333", light1: "FFFFFF" },
      },
    },
  ],
  slides: [{ children: [] }],
});

Master Children

Add decorative shapes to a master using the children property:

import { generatePresentation } from "@office-open/pptx";

generatePresentation({
  masters: [
    {
      name: "branded",
      children: [
        {
          shape: {
            x: "0.0cm",
            y: "16.9cm",
            width: "25.4cm",
            height: "1.1cm",
            fill: "4472C4",
          },
        },
      ],
    },
  ],
  slides: [],
});

Master Placeholders

Control which placeholders appear on the master and their positions:

import { generatePresentation } from "@office-open/pptx";

generatePresentation({
  masters: [
    {
      name: "custom",
      placeholders: {
        title: { x: "1.3cm", y: "0.5cm", width: "22.8cm", height: "2.1cm" },
        body: { x: "1.3cm", y: "3.2cm", width: "22.8cm", height: "13.2cm" },
        date: false, // hide date
        footer: false, // hide footer
        slideNumber: true, // use default position
      },
    },
  ],
  slides: [],
});

Multiple Masters

Define multiple masters and reference them from slides:

import { generatePresentation } from "@office-open/pptx";

generatePresentation({
  masters: [
    {
      name: "light",
      theme: { name: "Light", colors: { dark1: "333333" } },
    },
    {
      name: "dark",
      background: { fill: "1B2A4A" },
      theme: { name: "Dark", colors: { dark1: "FFFFFF", light1: "1B2A4A" } },
    },
  ],
  slides: [
    { master: "light", children: [] },
    { master: "dark", children: [] },
  ],
});

Slide Layout

Specify a slide's layout type using the layout property:

import { generatePresentation } from "@office-open/pptx";

generatePresentation({
  slides: [
    {
      layout: "title", // or "blank", "obj", "secHead", etc.
      children: [],
    },
  ],
});

Layout Types

TypeDisplay Name
"blank"Blank
"title"Title Slide
"obj"Title and Content
"secHead"Section Header
"twoObj"Two Content
"twoTxTwoObj"Comparison
"titleOnly"Title Only
"objTx"Content with Caption
"picTx"Picture with Caption
"vertTx"Vertical Text
"vertTitleAndTx"Vertical Title and Text
"tx"Title and Text
"twoColTx"Two Content
"chart"Content with Caption
"tbl"Content with Caption

Theme Options

Customize theme colors and fonts for each master:

Color Scheme

PropertyDescription
dark1Dark primary
light1Light primary
dark2Dark secondary
light2Light secondary
accent1accent6Accent colors
hyperlinkHyperlink color
followedHyperlinkVisited link color

Font Scheme

PropertyDescription
majorFontHeading font (Latin)
minorFontBody font (Latin)
majorFontAsianHeading font (East Asian)
minorFontAsianBody font (East Asian)
Copyright © 2026