RepositoryJavaScriptCNChina
pipipi-pikachu

pipipi-pikachu/pptxtojson

Office PowerPoint(.pptx) file to JSON | 将 PPTX 文件转为可读的 JSON 数据

458stars
126forks
1issues
7views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: pptxtojson

#1 Repository of the month

1
TINIX TRENDING·Topic: ppt2json

#1 Repository of the month

1
TINIX TRENDING·Topic: parse

#1 Repository of the month

🎨 pptxtojson

npm-version npm download GitHub issues license GitHub stars GitHub forks

简体中文 | English

pptxtojson is a browser-first PPTX parser that converts .pptx files into clean, readable, structured JSON.

Live demo: https://pipipi-pikachu.github.io/pptxtojson/

China mirrors, regularly synced: Gitee, GitCode

✨ Core Capabilities

  • Browser-side parsing: Read .pptx files directly in the browser, making it suitable for handling local user files without uploading them to a server for conversion.
  • Readable JSON output: Organize results by slides, elements, assets, themes, and related structures instead of exposing raw Office XML as low-level objects.
  • Built for secondary processing: Compared with simply converting PPTX to HTML, pptxtojson focuses more on data readability and programmability, making it easier to plug into downstream workflows.

🚀 Use Cases

  • Web editor import: Convert PPTX slides and elements into an editable data model, such as PPTist.
  • Content extraction: Extract text, speaker notes, media assets, and other information for search, archiving, review, or data analysis.
  • AI document understanding: Turn presentation content into structured input for summarization, question answering, knowledge-base ingestion, and similar workflows.
  • Custom rendering: Build your own preview, thumbnails, editing canvas, or conversion pipeline from the JSON result.

🔨 Installation

npm install pptxtojson

💿 Usage

parse(file, options = {})

Browser Example

<input type="file" accept="application/vnd.openxmlformats-officedocument.presentationml.presentation"/>
import { parse } from 'pptxtojson'

document.querySelector('input').addEventListener('change', evt => {
	const file = evt.target.files[0]
	
	const reader = new FileReader()
	reader.onload = async e => {
		const json = await parse(e.target.result, {
			imageMode: 'base64',
			videoMode: 'none',
			audioMode: 'none',
		})
		console.log(json)
	}
	reader.readAsArrayBuffer(file)
})

Node.js Example (experimental, v1.5.0+)

const pptxtojson = require('pptxtojson/dist/index.cjs')
const fs = require('fs')

async function func() {
  const buffer = fs.readFileSync('test.pptx')

  const json = await pptxtojson.parse(buffer.buffer, {
    imageMode: 'base64',
    videoMode: 'none',
    audioMode: 'none',
  })
  console.log(json)
}

func()

Output Example

{
	"slides": [
		{
			"fill": {
				"type": "color",
				"value": "#FF0000"
			},
			"elements": [
				{
					"left":	0,
					"top": 0,
					"width": 72,
					"height":	72,
					"borderColor": "#1F4E79",
					"borderWidth": 1,
					"borderType": "solid",
					"borderStrokeDasharray": 0,
					"fill": {
						"type": "color",
						"value": "#FF0000"
					},
					"content": "<p style=\"text-align: center;\"><span style=\"font-size: 18pt;font-family: Calibri;\">TEST</span></p>",
					"isFlipV": false,
					"isFlipH": false,
					"rotate": 0,
					"vAlign": "mid",
					"name": "Rectangle 1",
					"type": "shape",
					"shapType": "rect"
				},
				// more...
			],
			"layoutElements": [
				// more...
			],
			"note": "Speaker notes..."
		},
		// more...
	],
	"themeColors": ['#4472C4', '#ED7D31', '#A5A5A5', '#FFC000', '#5B9BD5', '#70AD47'],
	"size": {
		"width": 960,
		"height": 540
	}
}

🎲 Options

options is optional. Default values are used when it is not provided.

  • imageMode: Controls how image assets are parsed. Available values: base64, blob, both, none. Default: base64.

    • base64 means only base64 is parsed.
    • blob means only blob is parsed.
    • both means both base64 and blob are parsed.
    • none means image content is not parsed.
  • videoMode: Controls how video assets are parsed. Available values: blob, none. Default: none.

    • blob means video blob is parsed.
    • none means video content is not parsed.
  • audioMode: Controls how audio assets are parsed. Available values: blob, none. Default: none.

    • blob means audio blob is parsed.
    • none means audio content is not parsed.

🎯 Notes

The current parsing result can achieve roughly 80%+ overall fidelity in layout and styling compared with the source file. For PPTX files manually created and edited from scratch by ordinary users, common page structures and basic styles can even reach 95%+ fidelity.

However, if the file comes from a complex online template, or if it was created by a highly skilled PowerPoint user with many "advanced techniques" such as complex masters, deeply nested groups, special shape effects, complex gradients, non-standard shapes, or complex SmartArt, the parsing difficulty increases significantly and the fidelity will decrease accordingly. These files are better treated as complex samples for separate evaluation.

Length Units

All numeric length values in the output JSON use pt (point) as the unit.

Legacy Version Notes

  • In version 0.x, all output length values used px (pixels).
  • In version 1.x and earlier:
    • Image elements used the src field to return base64 data.
    • Image fills only returned picBase64.
    • Video elements might return blob or src.
    • Audio elements only returned blob.
    • Formula images only returned picBase64.

📕 Parsed Properties

  • Slide theme colors themeColors

  • Embedded font list usedFonts

  • Slide size size

    • Width width
    • Height height
  • Slides slides

    • Speaker notes note

    • Slide background fill (color, image, gradient, pattern) fill

      • Solid color fill type='color'
      • Image fill type='image'
      • Gradient fill type='gradient'
      • Pattern fill type='pattern'
    • Slide transition transition

      • Type type
      • Duration duration
      • Direction direction
    • Slide elements elements / master layout elements layoutElements

      • Text

        • Type type='text'
        • Horizontal coordinate left
        • Vertical coordinate top
        • Width width
        • Height height
        • Border color borderColor
        • Border width borderWidth
        • Border type (solid, dotted, dashed) borderType
        • Non-solid border style borderStrokeDasharray
        • Shadow shadow
        • Fill (color, image, gradient, pattern) fill
        • Text content (HTML rich text) content:
          • Inline styles/structure: font family, font size, color, gradient, underline, strikethrough, italic, bold, character spacing, shadow, superscript/subscript, hyperlink
          • Block-level styles/structure: horizontal alignment, line spacing, paragraph spacing, indentation, first-line indentation, bullets, numbered lists
        • Vertical flip isFlipV
        • Horizontal flip isFlipH
        • Rotation angle rotate
        • Vertical alignment vAlign
        • Whether it is vertical text isVertical
        • Element name name
        • Auto fit autoFit
          • Type type
            • shape: the text box height automatically adjusts according to the text content
            • text: the text box size is fixed, and the font size is automatically scaled to fit the text box (note: when autoFit does not exist, the text box size is also fixed, but the font size is not scaled)
          • Font scale ratio (only for type='text', default is 1) fontScale
        • Text inset on four sides textInset
        • Hyperlink link
      • Image

        • Type type='image'
        • Horizontal coordinate left
        • Vertical coordinate top
        • Width width
        • Height height
        • Border color borderColor
        • Border width borderWidth
        • Border type (solid, dotted, dashed) borderType
        • Non-solid border style borderStrokeDasharray
        • Crop shape geom
        • Crop rectangle rect
        • Asset reference path ref
        • Image base64 base64
        • Image blob blob
        • Rotation angle rotate
        • Filters filters
        • Hyperlink link
      • Shape

        • Type type='shape'
        • Horizontal coordinate left
        • Vertical coordinate top
        • Width width
        • Height height
        • Border color borderColor
        • Border width borderWidth
        • Border type (solid, dotted, dashed) borderType
        • Non-solid border style borderStrokeDasharray
        • Shadow shadow
        • Fill (color, image, gradient, pattern) fill
        • Stroke only (no fill) strokeOnly
        • Text content (HTML rich text, same as text elements) content
        • Vertical flip isFlipV
        • Horizontal flip isFlipH
        • Rotation angle rotate
        • Shape type shapType
        • Vertical alignment vAlign
        • Shape path path
        • Shape path viewBox pathViewBox
        • Line head endpoint headEnd
        • Line tail endpoint tailEnd
        • Shape adjustment parameters keypoints
        • Element name name
        • Auto fit autoFit
        • Text inset on four sides textInset
        • Hyperlink link
      • Table

        • Type type='table'
        • Horizontal coordinate left
        • Vertical coordinate top
        • Width width
        • Height height
        • Borders on four sides borders
        • Cell styles and data data
        • Row heights rowHeights
        • Column widths colWidths
      • Chart

        • Type type='chart'
        • Horizontal coordinate left
        • Vertical coordinate top
        • Width width
        • Height height
        • Chart data data
        • Chart theme colors colors
        • Chart type chartType
        • Bar chart direction barDir
        • Whether markers are enabled marker
        • Doughnut chart hole size holeSize
        • Grouping mode grouping
        • Chart style style
      • Video

        • Type type='video'
        • Horizontal coordinate left
        • Vertical coordinate top
        • Width width
        • Height height
        • Asset reference path ref
        • Video blob blob
      • Audio

        • Type type='audio'
        • Horizontal coordinate left
        • Vertical coordinate top
        • Width width
        • Height height
        • Asset reference path ref
        • Audio blob blob
      • Formula

        • Type type='math'
        • Horizontal coordinate left
        • Vertical coordinate top
        • Width width
        • Height height
        • Formula image reference path picRef
        • Formula image base64 picBase64
        • Formula image blob picBlob
        • LaTeX expression (only common structures are supported) latex
        • Text (exists when text and formulas are mixed) text
      • SmartArt

        • Type type='diagram'
        • Horizontal coordinate left
        • Vertical coordinate top
        • Width width
        • Height height
        • Child elements elements
        • Text list (text content list in SmartArt) textList
      • Group

        • Type type='group'
        • Horizontal coordinate left
        • Vertical coordinate top
        • Width width
        • Height height
        • Child elements elements

See more detailed types here 👇

https://github.com/pipipi-pikachu/pptxtojson/blob/master/dist/index.d.ts

🙏 Acknowledgements

pptxtojson refers heavily to the implementations of PPTX2HTML and PPTXjs.

Unlike those projects, pptxtojson does not aim to convert PPT files into HTML pages. Instead, it outputs clean, readable JSON that is easier to process further, and it includes many optimizations and additions to improve the completeness and accuracy of extracted information.

Issues and PRs with more PPTX samples, parsing scenarios, and improvement suggestions are welcome.

📄 License

MIT License | Copyright © 2020-PRESENT pipipi-pikachu

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
hugohe3/ppt-master

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

82.0k
Dec 2, 2026
RepositoryVue
pipipi-pikachu/PPTist

PowerPoint-ist(/'pauəpɔintist/), An online presentation application that replicates most of the commonly used features of MS PowerPoint, allowing for the editing and presentation of PPT online. It also supports AIPPT and local PPTX file preview.

9.5k
Nov 27, 2026
RepositoryPython
ningzimu/codex-ppt-skill

GPT-Image-2 PPT Generator Skill for Creating Image-Based PowerPoint Presentations in Codex and Other Skill-Compatible Agents

8.3k
Nov 16, 2026
RepositoryPHP
PHPOffice/PHPPresentation

A pure PHP library for reading and writing presentations documents

1.4k
Nov 9, 2026
RepositoryPython
sunbigfly/ppt-agent-skills

A code-driven presentation generation framework. 像构建软件工程一样生成演示文稿。

933
Jun 8, 2026
RepositoryPython
addsumtech/slides_maker

Turn papers, code, and docs into presentation-ready, natively editable PPTX in Codex / Claude Code. Native charts and equations, speaker notes, click-build animations, and an independent critic review before delivery. Comes with a visual-language template library, updated continuously.

709
Nov 28, 2026
RepositoryPython
helloo1568/slidemuse

将 PDF、论文、报告与笔记制作成风格统一的图片 PPT,按需还原为可编辑 PPTX。用于工作汇报、教学培训、学术分享、竞赛答辩、产品路演与创意展示。

255
Nov 20, 2026
RepositoryJavaScript
chuspeeism/dashi-ppt-skill

An AI-agent skill that generates browser-editable presentations from multiple visual themes, exportable to HTML, PDF, and PPTX.

11.3k
Nov 6, 2026
RepositoryGo
json-iterator/go

A high-performance 100% compatible drop-in replacement of "encoding/json"

13.8k
May 27, 2024