PPTX

Slide Layout

Configure slide size, background, and speaker notes

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

Slide Dimensions

Set custom width and height on the Presentation:

import { Presentation, Slide, Shape } from "@office-open/pptx";

const pres = new Presentation({
    slideWidth: 13.33, // Width in inches
    slideHeight: 7.5, // Height in inches
    slides: [
        new Slide({
            children: [new Shape({ x: 1, y: 1, width: 11, height: 5, text: "Widescreen content" })],
        }),
    ],
});

Slide Size Presets

Use SlideSizePreset for standard dimensions:

import { Presentation, SlideSizePreset } from "@office-open/pptx";

const pres = new Presentation({
    slideWidth: SlideSizePreset.WIDESCREEN_16_9, // 13.33 x 7.5 inches
    // slideWidth: SlideSizePreset.STANDARD_4_3,     // 10 x 7.5 inches
    // slideWidth: SlideSizePreset.A3_PORTRAIT,      // 11.69 x 16.54 inches
    // slideWidth: SlideSizePreset.A4_LANDSCAPE,     // 11.69 x 8.27 inches
    slides: [],
});

Common Presets

PresetDimensions (inches)Aspect Ratio
WIDESCREEN_16_913.33 x 7.516:9
STANDARD_4_310 x 7.54:3
A3_PORTRAIT11.69 x 16.54A3 portrait
A3_LANDSCAPE16.54 x 11.69A3 landscape
A4_PORTRAIT8.27 x 11.69A4 portrait
A4_LANDSCAPE11.69 x 8.27A4 landscape
LETTER_PORTRAIT8.5 x 11US Letter portrait
LETTER_LANDSCAPE11 x 8.5US Letter landscape
BANNER13.33 x 3.75Banner

Slide Background

Solid Color

new Slide({
    background: { type: "solid", color: "1F4E79" },
    children: [],
});

Gradient

new Slide({
    background: {
        type: "gradient",
        stops: [
            { position: 0, color: "0D47A1" },
            { position: 100, color: "1976D2" },
        ],
        angle: 90,
    },
    children: [],
});

Image Background

import fs from "node:fs";

new Slide({
    background: {
        type: "image",
        data: fs.readFileSync("bg.png"),
        imageType: "png",
    },
    children: [],
});

Speaker Notes

Add notes that are visible in presenter mode:

new Slide({
    children: [new Shape({ x: 1, y: 1, width: 8, height: 5, text: "Slide content" })],
    notes: "Remember to emphasize the key metrics in this slide. Pause for questions after showing the chart.",
});

Presentation Metadata

const pres = new Presentation({
    title: "Annual Report 2025",
    creator: "John Doe",
    company: "Acme Inc.",
    description: "Yearly financial summary",
    subject: "Finance",
    keywords: "annual, report, finance",
    slides: [],
});

Unit Conversion Helpers

import { convertPixelsToEmu, convertEmuToPixels, percentToTHousandths } from "@office-open/pptx";

convertPixelsToEmu(800); // Pixels to EMU
convertEmuToPixels(914400); // EMU to pixels
percentToTHousandths(75); // 75% → 750000 (thousandths of a percent)
Copyright © 2026