@jsamuel1/pptxgenjs 4.1.0
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/LICENSE +21 -0
- package/README.md +228 -0
- package/dist/pptxgen.bundle.js +96 -0
- package/dist/pptxgen.bundle.js.map +1 -0
- package/dist/pptxgen.cjs.js +7792 -0
- package/dist/pptxgen.es.js +7790 -0
- package/dist/pptxgen.min.js +96 -0
- package/dist/pptxgen.min.js.map +1 -0
- package/package.json +108 -0
- package/types/index.d.ts +2679 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-2022 Brent Ely
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# PptxGenJS
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## π Features
|
|
12
|
+
|
|
13
|
+
**PptxGenJS lets you generate professional PowerPoint presentations in JavaScript - directly from Node, React, Vite, Electron, or even the browser.**
|
|
14
|
+
The library outputs standards-compliant Open Office XML (OOXML) files compatible with:
|
|
15
|
+
|
|
16
|
+
- β
Microsoft PowerPoint
|
|
17
|
+
- β
Apple Keynote
|
|
18
|
+
- β
LibreOffice Impress
|
|
19
|
+
- β
Google Slides (via import)
|
|
20
|
+
|
|
21
|
+
Design custom slides, charts, images, tables, and templates programmatically - no PowerPoint install or license required.
|
|
22
|
+
|
|
23
|
+
### Works Everywhere
|
|
24
|
+
|
|
25
|
+
- Supports every major modern browser - desktop and mobile
|
|
26
|
+
- Seamlessly integrates with **Node.js**, **React**, **Angular**, **Vite**, and **Electron**
|
|
27
|
+
- Compatible with **PowerPoint**, **Keynote**, **LibreOffice**, and other OOXML apps
|
|
28
|
+
|
|
29
|
+
### Full-Featured
|
|
30
|
+
|
|
31
|
+
- Create all major slide objects: **text, tables, shapes, images, charts**, and more
|
|
32
|
+
- Define custom **Slide Masters** for consistent academic or corporate branding
|
|
33
|
+
- Supports **SVGs**, **animated GIFs**, **YouTube embeds**, **RTL text**, and **Asian fonts**
|
|
34
|
+
|
|
35
|
+
### Simple & Powerful
|
|
36
|
+
|
|
37
|
+
- Ridiculously easy to use - create a presentation in 4 lines of code
|
|
38
|
+
- Full **TypeScript definitions** for autocomplete and inline documentation
|
|
39
|
+
- Includes **75+ demo slides** covering every feature and usage pattern
|
|
40
|
+
|
|
41
|
+
### Export Your Way
|
|
42
|
+
|
|
43
|
+
- Instantly download `.pptx` files from the browser with proper MIME handling
|
|
44
|
+
- Export as **base64**, **Blob**, **Buffer**, or **Node stream**
|
|
45
|
+
- Supports compression and advanced output options for production use
|
|
46
|
+
|
|
47
|
+
### HTML to PowerPoint Magic
|
|
48
|
+
|
|
49
|
+
- Convert any HTML `<table>` to one or more slides with a single line of code β [Explore the HTML-to-PPTX feature](#html-to-powerpoint-magic)
|
|
50
|
+
|
|
51
|
+
## π Live Demos
|
|
52
|
+
|
|
53
|
+
Try PptxGenJS right in your browser - no setup required.
|
|
54
|
+
|
|
55
|
+
- [Basic Slide Demo](https://gitbrent.github.io/PptxGenJS/demos/) - Build a basic presentation in seconds
|
|
56
|
+
- [Full Feature Showcase](https://gitbrent.github.io/PptxGenJS/demo/browser/index.html) - Explore every available feature
|
|
57
|
+
|
|
58
|
+
> Perfect for testing compatibility or learning by example - all demos run 100% in the browser.
|
|
59
|
+
|
|
60
|
+
## π¦ Installation
|
|
61
|
+
|
|
62
|
+
Choose your preferred method to install **PptxGenJS**:
|
|
63
|
+
|
|
64
|
+
### Quick Install (Node-based)
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install pptxgenjs
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
yarn add pptxgenjs
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### CDN (Browser Usage)
|
|
75
|
+
|
|
76
|
+
Use the bundled or minified version via [jsDelivr](https://www.jsdelivr.com/package/gh/gitbrent/pptxgenjs):
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<script src="https://cdn.jsdelivr.net/gh/gitbrent/pptxgenjs/dist/pptxgen.bundle.js"></script>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
> Includes the sole dependency (JSZip) in one file.
|
|
83
|
+
|
|
84
|
+
π Advanced: Separate Files, Direct Download
|
|
85
|
+
|
|
86
|
+
Download from GitHub: [Latest Release](https://github.com/gitbrent/PptxGenJS/releases/latest)
|
|
87
|
+
|
|
88
|
+
```html
|
|
89
|
+
<script src="PptxGenJS/libs/jszip.min.js"></script>
|
|
90
|
+
<script src="PptxGenJS/dist/pptxgen.min.js"></script>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Contributors: Running the Test Suite
|
|
94
|
+
|
|
95
|
+
> Running `npm test` from a clone requires a one-time `./tools/ooxml-validator/install.sh` to download the OOXML schema validator into `tools/ooxml-validator/bin/`.
|
|
96
|
+
|
|
97
|
+
## π Universal Compatibility
|
|
98
|
+
|
|
99
|
+
PptxGenJS works seamlessly in **modern web and Node environments**, thanks to dual ESM and CJS builds and zero runtime dependencies. Whether you're building a CLI tool, an Electron app, or a web-based presentation builder, the library adapts automatically to your stack.
|
|
100
|
+
|
|
101
|
+
### Supported Platforms
|
|
102
|
+
|
|
103
|
+
- **Node.js** β generate presentations in backend scripts, APIs, or CLI tools
|
|
104
|
+
- **React / Angular / Vite / Webpack** β just import and go, no config required
|
|
105
|
+
- **Electron** β build native apps with full filesystem access and PowerPoint output
|
|
106
|
+
- **Browser (Vanilla JS)** β embed in web apps with direct download support
|
|
107
|
+
- **Serverless / Edge Functions** β use in AWS Lambda, Vercel, Cloudflare Workers, etc.
|
|
108
|
+
|
|
109
|
+
> _Vite, Webpack, and modern bundlers automatically select the right build via the `exports` field in `package.json`._
|
|
110
|
+
|
|
111
|
+
### Builds Provided
|
|
112
|
+
|
|
113
|
+
- **CommonJS**: [`dist/pptxgen.cjs.js`](./dist/pptxgen.cjs.js)
|
|
114
|
+
- **ES Module**: [`dist/pptxgen.es.js`](./dist/pptxgen.es.js)
|
|
115
|
+
|
|
116
|
+
## π Documentation
|
|
117
|
+
|
|
118
|
+
### Quick Start Guide
|
|
119
|
+
|
|
120
|
+
PptxGenJS PowerPoint presentations are created via JavaScript by following 4 basic steps:
|
|
121
|
+
|
|
122
|
+
#### Angular/React, ES6, TypeScript
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
import pptxgen from "pptxgenjs";
|
|
126
|
+
|
|
127
|
+
// 1. Create a new Presentation
|
|
128
|
+
let pres = new pptxgen();
|
|
129
|
+
|
|
130
|
+
// 2. Add a Slide
|
|
131
|
+
let slide = pres.addSlide();
|
|
132
|
+
|
|
133
|
+
// 3. Add one or more objects (Tables, Shapes, Images, Text and Media) to the Slide
|
|
134
|
+
let textboxText = "Hello World from PptxGenJS!";
|
|
135
|
+
let textboxOpts = { x: 1, y: 1, color: "363636" };
|
|
136
|
+
slide.addText(textboxText, textboxOpts);
|
|
137
|
+
|
|
138
|
+
// 4. Save the Presentation
|
|
139
|
+
pres.writeFile();
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Script/Web Browser
|
|
143
|
+
|
|
144
|
+
```javascript
|
|
145
|
+
// 1. Create a new Presentation
|
|
146
|
+
let pres = new PptxGenJS();
|
|
147
|
+
|
|
148
|
+
// 2. Add a Slide
|
|
149
|
+
let slide = pres.addSlide();
|
|
150
|
+
|
|
151
|
+
// 3. Add one or more objects (Tables, Shapes, Images, Text and Media) to the Slide
|
|
152
|
+
let textboxText = "Hello World from PptxGenJS!";
|
|
153
|
+
let textboxOpts = { x: 1, y: 1, color: "363636" };
|
|
154
|
+
slide.addText(textboxText, textboxOpts);
|
|
155
|
+
|
|
156
|
+
// 4. Save the Presentation
|
|
157
|
+
pres.writeFile();
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
That's really all there is to it!
|
|
161
|
+
|
|
162
|
+
## π₯ HTML-to-PowerPoint Magic
|
|
163
|
+
|
|
164
|
+
Convert any HTML `<table>` into fully formatted PowerPoint slides - automatically and effortlessly.
|
|
165
|
+
|
|
166
|
+
```javascript
|
|
167
|
+
let pptx = new pptxgen();
|
|
168
|
+
pptx.tableToSlides("tableElementId");
|
|
169
|
+
pptx.writeFile({ fileName: "html2pptx-demo.pptx" });
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Perfect for transforming:
|
|
173
|
+
|
|
174
|
+
- Dynamic dashboards and data reports
|
|
175
|
+
- Exportable grids in web apps
|
|
176
|
+
- Tabular content from CMS or BI tools
|
|
177
|
+
|
|
178
|
+
[View Full Docs & Live Demo](https://gitbrent.github.io/PptxGenJS/html2pptx/)
|
|
179
|
+
|
|
180
|
+
## π Full Documentation
|
|
181
|
+
|
|
182
|
+
Complete API reference, tutorials, and integration guides are available on the official docs site: [https://gitbrent.github.io/PptxGenJS](https://gitbrent.github.io/PptxGenJS)
|
|
183
|
+
|
|
184
|
+
## π οΈ Issues / Suggestions
|
|
185
|
+
|
|
186
|
+
Please file issues or suggestions on the [issues page on github](https://github.com/gitbrent/PptxGenJS/issues/new), or even better, [submit a pull request](https://github.com/gitbrent/PptxGenJS/pulls). Feedback is always welcome!
|
|
187
|
+
|
|
188
|
+
When reporting issues, please include a code snippet or a link demonstrating the problem.
|
|
189
|
+
Here is a small [jsFiddle](https://jsfiddle.net/gitbrent/L1uctxm0/) that is already configured and uses the latest PptxGenJS code.
|
|
190
|
+
|
|
191
|
+
## π Need Help?
|
|
192
|
+
|
|
193
|
+
Sometimes implementing a new library can be a difficult task and the slightest mistake will keep something from working. We've all been there!
|
|
194
|
+
|
|
195
|
+
If you are having issues getting a presentation to generate, check out the code in the `demos` directory. There
|
|
196
|
+
are demos for browser, node and, react that contain working examples of every available library feature.
|
|
197
|
+
|
|
198
|
+
- Use a pre-configured jsFiddle to test with: [PptxGenJS Fiddle](https://jsfiddle.net/gitbrent/L1uctxm0/)
|
|
199
|
+
- [View questions tagged `PptxGenJS` on StackOverflow](https://stackoverflow.com/questions/tagged/pptxgenjs?sort=votes&pageSize=50). If you can't find your question, [ask it yourself](https://stackoverflow.com/questions/ask?tags=PptxGenJS) - be sure to tag it `pptxgenjs`.
|
|
200
|
+
- Ask your AI pair programmer! All major LLMs have ingested the pptxgenjs library and have the ability to answer functionality questions and provide code.
|
|
201
|
+
|
|
202
|
+
## π Contributors
|
|
203
|
+
|
|
204
|
+
Thank you to everyone for the contributions and suggestions! β€οΈ
|
|
205
|
+
|
|
206
|
+
Special Thanks:
|
|
207
|
+
|
|
208
|
+
- [Dzmitry Dulko](https://github.com/DzmitryDulko) - Getting the project published on NPM
|
|
209
|
+
- [Michal KacerovskΓ½](https://github.com/kajda90) - New Master Slide Layouts and Chart expertise
|
|
210
|
+
- [Connor Bowman](https://github.com/conbow) - Adding Placeholders
|
|
211
|
+
- [Reima Frgos](https://github.com/ReimaFrgos) - Multiple chart and general functionality patches
|
|
212
|
+
- [Matt King](https://github.com/kyrrigle) - Chart expertise
|
|
213
|
+
- [Mike Wilcox](https://github.com/clubajax) - Chart expertise
|
|
214
|
+
- [Joonas](https://github.com/wyozi) - [react-pptx](https://github.com/wyozi/react-pptx)
|
|
215
|
+
|
|
216
|
+
PowerPoint shape definitions and some XML code via [Officegen Project](https://github.com/Ziv-Barber/officegen)
|
|
217
|
+
|
|
218
|
+
## π Support the Open Source Community
|
|
219
|
+
|
|
220
|
+
If you find this library useful, consider contributing to open-source projects, or sharing your knowledge on the open social web. Together, we can build free tools and resources that empower everyone.
|
|
221
|
+
|
|
222
|
+
[@gitbrent@fosstodon.org](https://fosstodon.org/@gitbrent)
|
|
223
|
+
|
|
224
|
+
## π License
|
|
225
|
+
|
|
226
|
+
Copyright © 2015-present [Brent Ely](https://github.com/gitbrent/)
|
|
227
|
+
|
|
228
|
+
[MIT](https://github.com/gitbrent/PptxGenJS/blob/master/LICENSE)
|