@christophervr/pptx-viewer 1.1.44 → 1.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -13
- package/README.md +50 -154
- package/dist/index.d.mts +1 -13530
- package/dist/index.mjs +637 -64052
- package/package.json +17 -62
- package/CHANGELOG.md +0 -79
- package/dist/SvgExporter-CYyO9c5A.d.mts +0 -557
- package/dist/SvgExporter-DdjrIx33.d.ts +0 -557
- package/dist/cli/index.d.mts +0 -150
- package/dist/cli/index.d.ts +0 -150
- package/dist/cli/index.js +0 -0
- package/dist/cli/index.mjs +0 -0
- package/dist/converter/index.d.mts +0 -48
- package/dist/converter/index.d.ts +0 -48
- package/dist/converter/index.js +0 -0
- package/dist/converter/index.mjs +0 -0
- package/dist/index.d.ts +0 -13530
- package/dist/index.js +0 -64641
- package/dist/presentation-BRAUjTRt.d.mts +0 -5787
- package/dist/presentation-BRAUjTRt.d.ts +0 -5787
- package/dist/signature-inspection-status-BCUpfCQh.d.mts +0 -220
- package/dist/signature-inspection-status-BCUpfCQh.d.ts +0 -220
- package/dist/signature-node/index.d.mts +0 -177
- package/dist/signature-node/index.d.ts +0 -177
- package/dist/signature-node/index.js +0 -1206
- package/dist/signature-node/index.mjs +0 -1143
- package/dist/text-operations-BJUOhA1w.d.ts +0 -134
- package/dist/text-operations-CkW4BO91.d.mts +0 -134
package/NOTICE
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
pptx-viewer
|
|
1
|
+
@christophervr/pptx-viewer
|
|
2
2
|
Copyright (c) 2025-present pptx-viewer contributors
|
|
3
3
|
|
|
4
4
|
This package is licensed under the Apache License 2.0. See the LICENSE file for
|
|
5
5
|
details. Under Section 4(d) of that license, please preserve this NOTICE (or the
|
|
6
6
|
attribution it contains) in any derivative works you distribute.
|
|
7
|
-
|
|
8
|
-
This package bundles the following component under a different license:
|
|
9
|
-
|
|
10
|
-
mtx-decompressor — MicroType Express (MTX) font decompressor
|
|
11
|
-
License: Mozilla Public License 2.0 (MPL-2.0)
|
|
12
|
-
Source: https://github.com/ChristopherVR/pptx-viewer/tree/main/packages/mtx-decompressor
|
|
13
|
-
Origin: Ported from libeot (https://github.com/nicowilliams/libeot)
|
|
14
|
-
by Brennan T. Vincent, licensed under MPL-2.0.
|
|
15
|
-
|
|
16
|
-
Under MPL-2.0, the source code of the mtx-decompressor component remains
|
|
17
|
-
available under the terms of the Mozilla Public License 2.0. The full text
|
|
18
|
-
of the MPL-2.0 can be found at: https://mozilla.org/MPL/2.0/
|
package/README.md
CHANGED
|
@@ -1,185 +1,81 @@
|
|
|
1
|
-
# pptx-viewer
|
|
1
|
+
# @christophervr/pptx-viewer
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/pptx-viewer-core)
|
|
3
|
+
[](https://www.npmjs.com/package/@christophervr/pptx-viewer)
|
|
4
|
+
[](https://github.com/ChristopherVR/pptx-viewer/blob/main/LICENSE)
|
|
6
5
|
|
|
7
|
-
>
|
|
6
|
+
> The interactive installer for the [pptx-viewer](https://github.com/ChristopherVR/pptx-viewer) family: pick what you're building, and it installs the right package(s) plus their required companions, or bootstraps a brand-new starter app for you.
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+

|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
This is what you get one `npx` away: a working `.pptx` viewer/editor, wired up in a React, Vue, or Angular app, or just the framework-agnostic engine on its own.
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<samp>**[📦 npm](https://www.npmjs.com/package/pptx-viewer-core)** · **[📖 Full docs](https://christophervr.github.io/pptx-viewer/)** · **[▶️ Live demo](https://christophervr.github.io/pptx-viewer/demo/)** · **[⚛️ React UI](https://www.npmjs.com/package/pptx-react-viewer)** · **[🖖 Vue UI](https://www.npmjs.com/package/pptx-vue-viewer)** · **[🅰️ Angular UI](https://www.npmjs.com/package/pptx-angular-viewer)**</samp>
|
|
12
|
+
<samp>**[▶️ Try the live demo](https://christophervr.github.io/pptx-viewer/demo/)** · **[📦 npm](https://www.npmjs.com/package/@christophervr/pptx-viewer)** · **[📖 Full docs](https://christophervr.github.io/pptx-viewer/)** · **[🧩 Core SDK](https://www.npmjs.com/package/pptx-viewer-core)**</samp>
|
|
16
13
|
|
|
17
14
|
---
|
|
18
15
|
|
|
19
|
-
##
|
|
16
|
+
## Usage
|
|
20
17
|
|
|
21
18
|
```bash
|
|
22
|
-
|
|
23
|
-
# required companions:
|
|
24
|
-
npm install jszip fast-xml-parser
|
|
19
|
+
npx @christophervr/pptx-viewer@latest
|
|
25
20
|
```
|
|
26
21
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## What it does
|
|
30
|
-
|
|
31
|
-
| Capability | Description |
|
|
32
|
-
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
33
|
-
| **Read** | Open a `.pptx` and pull out slides, text, shapes, images, charts, tables, SmartArt, themes, comments, animations, transitions, and document info |
|
|
34
|
-
| **Edit** | Change the data in memory: add, remove, or reorder slides; insert elements; edit text; restyle; switch themes |
|
|
35
|
-
| **Save** | Write the changed data back to a valid `.pptx`, leaving everything you did not touch untouched |
|
|
36
|
-
| **Convert** | Turn a deck into Markdown, optionally pulling the images out alongside it |
|
|
37
|
-
| **Export** | Save individual slides as their own standalone `.pptx` files |
|
|
38
|
-
| **Protect** | Open and save password-protected files (AES-128/256 encryption) |
|
|
39
|
-
|
|
40
|
-
Positions and sizes use PowerPoint's own internal unit, the EMU (English Metric Unit): 1 inch = 914,400 EMU, 1 point = 12,700 EMU, and 1 pixel = 9,525 EMU at 96 DPI. You rarely deal with the raw numbers: helpers (`inches`, `cm`, `mm`, `pt`) let you work in familiar units instead.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Quick start
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
import { PptxHandler } from 'pptx-viewer-core';
|
|
48
|
-
|
|
49
|
-
// 1. Open a .pptx file
|
|
50
|
-
const handler = new PptxHandler();
|
|
51
|
-
const buffer = await fetch('presentation.pptx').then((r) => r.arrayBuffer());
|
|
52
|
-
const data = await handler.load(buffer);
|
|
22
|
+
It first asks what you're building (multiple choice, comma-separated):
|
|
53
23
|
|
|
54
|
-
console.log(
|
|
55
|
-
`${data.slides.length} slides, canvas ${data.canvasSize.width}×${data.canvasSize.height}`,
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
// 2. Change a slide
|
|
59
|
-
data.slides[0].elements[0].text = 'Updated title';
|
|
60
|
-
|
|
61
|
-
// 3. Save it back to .pptx bytes
|
|
62
|
-
const outputBytes = await handler.save(data.slides); // => Uint8Array
|
|
63
|
-
|
|
64
|
-
// 4. Or pull out just a few slides as separate files
|
|
65
|
-
const exports = await handler.exportSlides(data.slides, { slideIndexes: [0, 2] }); // => Map<number, Uint8Array>
|
|
66
24
|
```
|
|
25
|
+
What are you building with pptx-viewer? (you can pick more than one)
|
|
67
26
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
import { Presentation, ThemePresets, ChartBuilder } from 'pptx-viewer-core';
|
|
76
|
-
|
|
77
|
-
const pptx = await Presentation.create({
|
|
78
|
-
title: 'Sales Report',
|
|
79
|
-
theme: ThemePresets.MODERN_BLUE,
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// Each slide is added to the deck automatically: no manual .build() or .push() needed
|
|
83
|
-
pptx
|
|
84
|
-
.addSlide('Title Slide')
|
|
85
|
-
.addText('Q4 Sales Report', { fontSize: 44, bold: true, x: 100, y: 200, width: 800, height: 80 });
|
|
86
|
-
|
|
87
|
-
pptx
|
|
88
|
-
.addSlide('Blank')
|
|
89
|
-
.addText('Revenue by Region', { fontSize: 28, x: 50, y: 30, width: 600, height: 50 })
|
|
90
|
-
.addBuilderElement(
|
|
91
|
-
ChartBuilder.create('bar')
|
|
92
|
-
.categories(['North', 'South', 'East', 'West'])
|
|
93
|
-
.addSeries('2026', [210, 150, 180, 120], '#2563EB')
|
|
94
|
-
.title('Revenue ($M)')
|
|
95
|
-
.bounds(50, 100, 860, 420),
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
pptx.replaceText('2026', 'FY2026'); // find/replace, merge, and templates all chain the same way
|
|
99
|
-
|
|
100
|
-
const bytes = await pptx.save();
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
The builder API comes in three levels, from highest to lowest:
|
|
104
|
-
|
|
105
|
-
1. **`Presentation`**: the whole deck at once (slides, text operations, sections, templates, merging, saving).
|
|
106
|
-
2. **Element builders**: one per element type, for fine-grained control: `TextBuilder`, `ShapeBuilder`, `ChartBuilder`, `TableBuilder`, `ImageBuilder`, `ConnectorBuilder`, `MediaBuilder`, `GroupBuilder`.
|
|
107
|
-
3. **`PptxXmlBuilder`**: raw XML, for the rare cases the higher levels do not cover.
|
|
108
|
-
|
|
109
|
-
It also ships unit helpers (`inches`, `cm`, `mm`, `pt`), common slide sizes (`SlideSizes`), and 8 ready-made themes (`ThemePresets`). The [full docs](https://christophervr.github.io/pptx-viewer/) cover every builder.
|
|
110
|
-
|
|
111
|
-
### Turn a deck into Markdown
|
|
112
|
-
|
|
113
|
-
```typescript
|
|
114
|
-
import { PptxMarkdownConverter } from 'pptx-viewer-core';
|
|
115
|
-
|
|
116
|
-
const converter = new PptxMarkdownConverter({ includeMetadata: true, imageHandling: 'extract' });
|
|
117
|
-
const result = await converter.convert(
|
|
118
|
-
buffer,
|
|
119
|
-
{ outputPath: 'output.md', mediaFolderName: 'media' },
|
|
120
|
-
fileSystemAdapter,
|
|
121
|
-
);
|
|
122
|
-
// => the Markdown text, plus stats on any images that were pulled out
|
|
27
|
+
1) React - pptx-react-viewer, a viewer/editor component for a React 19 app
|
|
28
|
+
2) Vue - pptx-vue-viewer, a viewer/editor component for a Vue 3.5+ app
|
|
29
|
+
3) Angular - pptx-angular-viewer, a viewer/editor component for an Angular 22+ app
|
|
30
|
+
4) Core engine only - pptx-viewer-core, the framework-agnostic SDK, no UI
|
|
31
|
+
5) MCP server - pptx-viewer-mcp, PowerPoint editing tools for AI agents
|
|
123
32
|
```
|
|
124
33
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
## `PptxHandler` API
|
|
130
|
-
|
|
131
|
-
`PptxHandler` is the one class you use to open, change, and save files. Its main methods:
|
|
34
|
+
Picking more than one is fine, for example React plus the MCP server to get both a viewer and AI-agent tooling in the same repo. `pptx-viewer-mcp` never gets installed as a dependency: since it's meant to be launched by an MCP client via `npx`, this just prints the client config to paste in.
|
|
132
35
|
|
|
133
|
-
|
|
134
|
-
| -------------------------- | ------------------------------------------------------- | ------------------------------------------------------ |
|
|
135
|
-
| `load` | `(data, options?) => Promise<PptxData>` | Open a `.pptx` and return the structured data |
|
|
136
|
-
| `save` | `(slides, options?) => Promise<Uint8Array>` | Write slides back to `.pptx` bytes |
|
|
137
|
-
| `exportSlides` | `(slides, options) => Promise<Map<number, Uint8Array>>` | Save chosen slides as standalone files |
|
|
138
|
-
| `getImageData` | `(path) => Promise<string \| undefined>` | Get an embedded image as a base64 data URL |
|
|
139
|
-
| `getMediaArrayBuffer` | `(path) => Promise<ArrayBuffer \| undefined>` | Get the raw bytes of an embedded media file |
|
|
140
|
-
| `getLayoutOptions` | `() => PptxLayoutOption[]` | List the slide layouts available |
|
|
141
|
-
| `getCompatibilityWarnings` | `() => PptxCompatibilityWarning[]` | List features in the file that are not fully supported |
|
|
142
|
-
| `applyTheme` | `(colors, fonts, name?) => Promise<void>` | Apply a complete theme |
|
|
143
|
-
| `setPresentationTheme` | `(path, applyToAll?) => Promise<void>` | Load a `.thmx` theme file |
|
|
36
|
+
### Compatibility check
|
|
144
37
|
|
|
145
|
-
|
|
38
|
+
If you picked React, Vue, or Angular and a `package.json` already exists in the current directory, the CLI looks at what's actually installed (or declared) for `react`, `vue`, or `@angular/core` and compares it against the major version each viewer package requires. If they don't match (say, `react@18` in a project but `pptx-react-viewer` needs `react@^19`), it warns you and asks whether to continue before touching anything.
|
|
146
39
|
|
|
147
|
-
|
|
40
|
+
### Install here, or scaffold a new project?
|
|
148
41
|
|
|
149
|
-
|
|
150
|
-
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
151
|
-
| **Element types** | 16: text, shape, connector, image, picture, table, chart, smartArt, ole, media, group, ink, contentPart, zoom, model3d, unknown |
|
|
152
|
-
| **Preset shapes** | 187+ PowerPoint shapes, including ones with adjustable handles |
|
|
153
|
-
| **Chart types** | 23, including waterfall, funnel, treemap, sunburst, box-whisker, region-map, and combo charts; with trendlines, error bars, and embedded Excel data |
|
|
154
|
-
| **Transitions** | 42 types (including morph, vortex, ripple, and shred) |
|
|
155
|
-
| **Animations** | 40+ presets, including colour animation, motion paths, and text that builds in by word, letter, or paragraph |
|
|
156
|
-
| **SmartArt** | 14 layout families, broken into editable shapes with a live reflow engine for structural edits |
|
|
157
|
-
| **Fills** | Solid, gradient (linear, radial, path), image, and 48 patterns |
|
|
158
|
-
| **Themes** | 8 built-in presets, switchable at runtime, with layout and placeholder remapping |
|
|
159
|
-
| **Security** | AES-128/256 encryption and decryption, modify-password (SHA), and detection of digital signatures |
|
|
160
|
-
| **Preserved** | VBA macros, custom XML, comment authors, and strict-format files are kept intact through a save |
|
|
42
|
+
When exactly one UI framework is selected, you're asked how to set it up:
|
|
161
43
|
|
|
162
|
-
|
|
44
|
+
- **Install here** adds the package(s) to the project in the current directory (a `package.json` must already exist; run `npm init -y` first if not).
|
|
45
|
+
- **Scaffold a new project** bootstraps a brand-new starter app in its own folder, using the framework's own official scaffolding tool ([`create-vite`](https://www.npmjs.com/package/create-vite) for React/Vue, [`@angular/cli`](https://www.npmjs.com/package/@angular/cli) for Angular), then wires in a minimal working `PowerPointViewer` example and installs the viewer package on top.
|
|
163
46
|
|
|
164
|
-
|
|
47
|
+
Scaffolding is only offered for a single framework at a time; if you select more than one UI framework together, the CLI installs into the current project instead.
|
|
165
48
|
|
|
166
|
-
|
|
49
|
+
Either way, it detects your package manager (`bun`, `pnpm`, `yarn`, or `npm`, from whichever lockfile is in the current directory) and prints a short quick-start snippet once it's done.
|
|
167
50
|
|
|
168
|
-
|
|
169
|
-
- **Shapes are drawn from a built-in catalogue** of 187+ PowerPoint shapes, so curves, arrows, and callouts come out with the right outlines.
|
|
170
|
-
- **Colours follow PowerPoint's theme rules**, so a colour defined as "accent 1, but 20% lighter" resolves to the correct final value for the active theme.
|
|
51
|
+
### Non-interactive use
|
|
171
52
|
|
|
172
|
-
|
|
53
|
+
```bash
|
|
54
|
+
npx @christophervr/pptx-viewer --target react,mcp --yes # skip both prompts
|
|
55
|
+
npx @christophervr/pptx-viewer --target mcp # just print the MCP client config
|
|
56
|
+
npx @christophervr/pptx-viewer --target react --scaffold --dir my-app --yes
|
|
57
|
+
npx @christophervr/pptx-viewer --pm pnpm # force a package manager instead of auto-detecting
|
|
58
|
+
```
|
|
173
59
|
|
|
174
|
-
|
|
60
|
+
| Flag | Meaning |
|
|
61
|
+
| ---------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| `--target <ids>` | Comma-separated: `react`, `vue`, `angular`, `core`, `mcp`. Skips the picker. |
|
|
63
|
+
| `--scaffold` | Bootstrap a new project instead of installing here. Needs exactly one of `react`/`vue`/`angular` selected. |
|
|
64
|
+
| `--dir <name>` | Project directory name for `--scaffold` (default: `pptx-<target>-app`). |
|
|
65
|
+
| `--pm <manager>` | `bun`, `pnpm`, `yarn`, or `npm`. Skips auto-detection. |
|
|
66
|
+
| `--yes`, `-y` | Skip confirmation prompts (including the compatibility warning). |
|
|
67
|
+
| `--help`, `-h` | Print usage. |
|
|
175
68
|
|
|
176
|
-
|
|
177
|
-
- **SmartArt** is broken into editable shapes. It uses PowerPoint's own pre-computed shape geometry when present; after structural edits (add/remove/reorder/promote/demote nodes) a live reflow engine rebuilds the shapes, with an algorithmic fallback covering 14 layout families for diagrams PowerPoint never rendered.
|
|
178
|
-
- **Chart editing** covers data, categories, and chart type, plus legend, axes (scale, format, titles, gridlines, log/display units), data labels, trendlines, error bars, and per-series/per-point markers and fills. A handful of rarely-used chart properties remain read-only for display.
|
|
179
|
-
- **Strict-format files** (ISO/IEC 29500 Strict) are converted to the more common Transitional form when opened and converted back when saved.
|
|
69
|
+
## What it installs
|
|
180
70
|
|
|
181
|
-
|
|
71
|
+
| Target | Package | What you get |
|
|
72
|
+
| -------------- | -------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
|
|
73
|
+
| **React** | [`pptx-react-viewer`](https://www.npmjs.com/package/pptx-react-viewer) | View, edit, present, collaborate, and export `.pptx` files in React 19. |
|
|
74
|
+
| **Vue** | [`pptx-vue-viewer`](https://www.npmjs.com/package/pptx-vue-viewer) | The Vue 3.5+ counterpart, feature-equivalent to the React package. |
|
|
75
|
+
| **Angular** | [`pptx-angular-viewer`](https://www.npmjs.com/package/pptx-angular-viewer) | The Angular 22+ counterpart, feature-equivalent to the React package. |
|
|
76
|
+
| **Core only** | [`pptx-viewer-core`](https://www.npmjs.com/package/pptx-viewer-core) | The framework-agnostic parse/edit/save/convert SDK, no UI. |
|
|
77
|
+
| **MCP server** | [`pptx-viewer-mcp`](https://www.npmjs.com/package/pptx-viewer-mcp) | 25 PowerPoint editing tools exposed to AI agents (Claude, Cursor, ...). |
|
|
182
78
|
|
|
183
|
-
##
|
|
79
|
+
## Why this exists
|
|
184
80
|
|
|
185
|
-
|
|
81
|
+
Each pptx-viewer package documents its own install command, but the exact list of companion packages differs per binding (peer dependencies like `react`/`vue`, shared ones like `jszip`/`fast-xml-parser`, optional ones like `three`). This CLI is that install line, made interactive, so you don't have to go look it up, plus a scaffold mode for starting from nothing.
|