# Pptxgenjs

> Create and manipulate PowerPoint (.pptx) presentations using PptxGenJS. Use when the user asks to generate, build, or modify PowerPoint slides, add charts, tables, images, shapes, or text to presentations, or automate PPT creation tasks.

- Skill: `rongrongyuehuanghun-oss/pptxgenjs` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add rongrongyuehuanghun-oss/pptxgenjs`
- Raw SKILL.md: https://api.skillmd.com/api/skills/rongrongyuehuanghun-oss/pptxgenjs/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: rongrongyuehuanghun-oss (https://skillmd.com/u/rongrongyuehuanghun-oss)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/rongrongyuehuanghun-oss/pptxgenjs

---


# PptxGenJS Skill

Generate PowerPoint presentations programmatically using PptxGenJS (Node.js library).

## Prerequisites

Before generating presentations, ensure PptxGenJS is installed:

```bash
npm install pptxgenjs
```

## Workflow

1. Determine the user requirements (slide count, content, layout, charts, tables, images).
2. Write a Node.js script that uses PptxGenJS to build the presentation.
3. Run the script to produce the .pptx file.
4. Confirm output path and provide the file to the user.

## Quick Reference

- Create presentation: const pptx = new PptxGenJS()
- Add slide: const slide = pptx.addSlide()
- Add text: slide.addText("Hello", { x: 1, y: 1, fontSize: 24 })
- Add shape: slide.addShape(pptx.shapes.RECTANGLE, { x: 0, y: 0, w: "100%", h: 0.5, fill: { color: "003366" } })
- Add image: slide.addImage({ path: "./img.png", x: 1, y: 2, w: 3, h: 2 })
- Add table: slide.addTable(rows, { x: 0.5, y: 1.5, colW: [2, 3, 2] })
- Add chart: slide.addChart(pptx.charts.BAR, data, opts)
- Save: await pptx.writeFile({ fileName: "output.pptx" })

## Best Practices

- Use async/await with pptx.writeFile() for reliable file output.
- Keep slide layouts consistent: define master slides via pptx.defineLayout() when reusing layouts.
- For CJK text, use system fonts like Microsoft YaHei to ensure rendering.
- Place generated files in the current working directory or a user-specified path.
- For complex charts and tables, refer to references/api_reference.md.

## Helper Script

Use scripts/create_pptx.py as a starting template for generating presentations via a Python wrapper that writes and executes a Node.js script.

## Error Handling

- If writeFile fails, check write permissions and disk space.
- If images do not render, verify file paths are absolute or relative to the script working directory.
- For font issues on Linux, install Microsoft core fonts or use freely available alternatives.
