@spinozapps/pptxgenjs
TypeScript icon, indicating that this package has built-in type declarations

3.12.0-spinozapps.1 • Public • Published

PptxGenJS

Create JavaScript PowerPoint Presentations

PptxGenJS Sample Slides


Known Vulnerabilities npm downloads jsdelivr downloads typescripts definitions

Spinozapps additions

This package is a variation of https://github.com/gitbrent/PptxGenJS with changes we proposed as pull requests integrated, and published under our NPM organization:

git clone git@github.com:gitbrent/PptxGenJS.git
git remote add spinozapps git@github.com:spinozapps/PptxGenJS.git

# Start from base version
git checkout v3.12.0

# https://github.com/gitbrent/PptxGenJS/pull/1021
git cherry-pick d74d90846d1783e7e7c2358503e7078fa94e8f0f

# https://github.com/gitbrent/PptxGenJS/pull/1025
git cherry-pick 7ab676c892336bec216a6c279f7f55ef467323eb

# https://github.com/spinozapps/PptxGenJS/pull/new/types/misc
git cherry-pick 51573f12fa5470a9bab4865dd7295f7f336f3e77

# Include build steps, look for commit id in https://github.com/spinozapps/PptxGenJS
# Note: there will be a conflict on package.json version field, set it to the next version to be published
git cherry-pick xxx

# Update steps + modify last commit with them
git commit --amend

# Build library
docker build . -t pptxgenjs

# Test it locally
docker run --rm -v $(pwd):/shared pptxgenjs cp -r /app/dist /shared

# Publish (set NPM_TOKEN to an actual token created on https://www.npmjs.com/ > Profile picture > Access Tokens)
docker run --rm -e NPM_TOKEN=... pptxgenjs npm publish --access public

git tag v3.12.0-spinozapps.1
git push spinozapps v3.12.0-spinozapps.1

Table of Contents

Introduction

This library creates Open Office XML (OOXML) Presentations which are compatible with Microsoft PowerPoint, Apple Keynote, and other applications.

Features

Works Everywhere

  • Every modern desktop and mobile browser is supported
  • Integrates with Node, Angular, React, and Electron
  • Compatible with PowerPoint, Keynote, and more

Full Featured

  • All major object types are available (charts, shapes, tables, etc.)
  • Master Slides for academic/corporate branding
  • SVG images, animated gifs, YouTube videos, RTL text, and Asian fonts

Simple and Powerful

  • The absolute easiest PowerPoint library to use
  • Learn as you code will full typescript definitions included
  • Tons of demo code comes included (over 75 slides of features)

Export Your Way

  • Exports files direct to client browsers with proper MIME-type
  • Other export formats available: base64, blob, stream, etc.
  • Presentation compression options and more

HTML to PowerPoint

  • Includes powerful HTML-to-PowerPoint feature to transform HTML tables into presentations with a single line of code

Live Demos

Visit the demos page to create a simple presentation to see how easy it is to use pptxgenjs, or check out the complete demo which showcases every available feature.

Installation

Npm

PptxGenJS NPM Home

npm install pptxgenjs --save

Yarn

yarn add pptxgenjs

CDN

jsDelivr Home

Bundle: Modern Browsers and IE11

<script src="https://cdn.jsdelivr.net/gh/gitbrent/pptxgenjs@3.12.0/dist/pptxgen.bundle.js"></script>

Min files: Modern Browsers

<script src="https://cdn.jsdelivr.net/gh/gitbrent/pptxgenjs@3.12.0/libs/jszip.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/gitbrent/pptxgenjs@3.12.0/dist/pptxgen.min.js"></script>

Download

GitHub Latest Release

Bundle: Modern Browsers

  • Use the bundle for IE11 support
<script src="PptxGenJS/dist/pptxgen.bundle.js"></script>

Min files: Modern Browsers

<script src="PptxGenJS/libs/jszip.min.js"></script>
<script src="PptxGenJS/dist/pptxgen.min.js"></script>

Additional Builds

  • CommonJS: dist/pptxgen.cjs.js
  • ES Module: dist/pptxgen.es.js

Documentation

Quick Start Guide

PptxGenJS PowerPoint presentations are created via JavaScript by following 4 basic steps:

Angular/React, ES6, TypeScript

import pptxgen from "pptxgenjs";

// 1. Create a new Presentation
let pres = new pptxgen();

// 2. Add a Slide
let slide = pres.addSlide();

// 3. Add one or more objects (Tables, Shapes, Images, Text and Media) to the Slide
let textboxText = "Hello World from PptxGenJS!";
let textboxOpts = { x: 1, y: 1, color: "363636" };
slide.addText(textboxText, textboxOpts);

// 4. Save the Presentation
pres.writeFile();

Script/Web Browser

// 1. Create a new Presentation
let pres = new PptxGenJS();

// 2. Add a Slide
let slide = pres.addSlide();

// 3. Add one or more objects (Tables, Shapes, Images, Text and Media) to the Slide
let textboxText = "Hello World from PptxGenJS!";
let textboxOpts = { x: 1, y: 1, color: "363636" };
slide.addText(textboxText, textboxOpts);

// 4. Save the Presentation
pres.writeFile();

That's really all there is to it!


Library API

Full documentation and code examples are available


HTML-to-PowerPoint Feature

Easily convert HTML tables to PowerPoint presentations in a single call.

let pptx = new PptxGenJS();
pptx.tableToSlides("tableElementId");
pptx.writeFile({ fileName: "html2pptx-demo.pptx" });

Learn more:


Library Ports

React: react-pptx - thanks to Joonas!


Issues / Suggestions

Please file issues or suggestions on the issues page on github, or even better, submit a pull request. Feedback is always welcome!

When reporting issues, please include a code snippet or a link demonstrating the problem. Here is a small jsFiddle that is already configured and uses the latest PptxGenJS code.


Need Help?

Sometimes implementing a new library can be a difficult task and the slightest mistake will keep something from working. We've all been there!

If you are having issues getting a presentation to generate, check out the code in the demos directory. There are demos for both client browsers, node and react that contain working examples of every available library feature.


Contributors

Thank you to everyone for the issues, contributions and suggestions! ❤️

Special Thanks:

PowerPoint shape definitions and some XML code via Officegen Project


Sponsor Us

If you find this library useful, please consider sponsoring us through a donation


License

Copyright © 2015-present Brent Ely

MIT

Dependencies (4)

Dev Dependencies (23)

Package Sidebar

Install

npm i @spinozapps/pptxgenjs

Weekly Downloads

65

Version

3.12.0-spinozapps.1

License

MIT

Unpacked Size

2.75 MB

Total Files

10

Last publish

Collaborators

  • mathbruyen