PowerPoint presentations, rendered in the browser.
PptxViewJS is a client-side JavaScript library that parses .pptx files and renders slides using HTML5 Canvas โ no server, no file uploads, no conversion services required.
๐ Product page ยท Interactive Demo ยท All demos
The interactive demo showcases the full client-side presentation round-trip:
- Generate โ pick a template (charts, tables, shapes, text, full deck) and click Run. PptxGenJS builds the
.pptxfile entirely in the browser. - Render โ PptxViewJS instantly renders the generated presentation on an HTML5 Canvas.
- Download โ save the
.pptxfile at any time.
The live code panel shows the exact PptxGenJS source used to generate each slide. No server involved at any step.
Available templates: Bar/Line/Pie/Area charts ยท Sales & comparison tables ยท Shapes ยท Text formatting ยท Full multi-slide deck (~18 slides)
| Demo | Description |
|---|---|
| ๐ฎ Interactive Demo | Generate with PptxGenJS โ render with PptxViewJS, live in the browser |
| ๐ Simple Viewer | Minimal drag-and-drop viewer โ perfect starting point |
| ๐ฅ๏ธ Full Featured UI | Office Onlineโstyle: thumbnails, zoom, fullscreen, keyboard shortcuts |
| ๐ Embedded Layout | Split view with thumbnail sidebar for docs portals and LMS platforms |
- โ Zero server dependencies โ all processing runs client-side
- โ Canvas rendering โ pixel-accurate slide display
- โ Charts โ bar, line, pie, area, doughnut via Chart.js (optional peer dep)
- โ Tables โ merged cells, borders, shading, complex headers
- โ Media & SVG โ embedded images and vector graphics
- โ Framework ready โ React, Vue, Svelte, Vite, Electron, Streamlit
- โ TypeScript โ full type definitions included
- โ Multiple formats โ ESM, CJS, and minified UMD builds
Choose your preferred method to install PptxViewJS:
npm install pptxviewjsyarn add pptxviewjsUse the UMD build via jsDelivr. Include JSZip (required) before the library. Include Chart.js (optional) if you need chart rendering:
<!-- Required: JSZip -->
<script src="https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js"></script>
<!-- Optional: Chart.js (only if your presentations contain charts) -->
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.min.js"></script>
<!-- PptxViewJS UMD build exposes global `PptxViewJS` -->
<script src="https://cdn.jsdelivr.net/npm/pptxviewjs/dist/PptxViewJS.min.js"></script>Note: JSZip is required for PPTX (ZIP) parsing. Chart.js is optional and only needed when rendering charts.
Install JSZip (required). Install Chart.js if your presentations include charts:
npm install jszip
# Optional (for charts)
npm install chart.jsPptxViewJS works seamlessly in modern web and Node environments, thanks to dual ESM and CJS builds and zero runtime dependencies. Whether you're building a web app, an Electron viewer, or a presentation platform, the library adapts automatically to your stack.
- React / Angular / Vue / Vite / Webpack โ just import and go, no config required
- Electron โ build native presentation viewers with full filesystem access
- Browser (Vanilla JS) โ embed in web apps with direct file handling
- Node.js โ experimental; requires a Canvas polyfill (e.g.,
canvas) for rendering - Serverless / Edge Functions โ use in AWS Lambda, Vercel, Cloudflare Workers, etc.
- CommonJS:
dist/PptxViewJS.cjs.js - ES Module:
dist/PptxViewJS.es.js - Minified UMD:
dist/PptxViewJS.min.js
PptxViewJS presentations are viewed via JavaScript by following 3 basic steps:
import { PPTXViewer } from "pptxviewjs";
// 1. Create a new Viewer
let viewer = new PPTXViewer({
canvas: document.getElementById('myCanvas')
});
// 2. Load a Presentation
await viewer.loadFile(presentationFile);
// 3. Render the first slide
await viewer.render();<canvas id="myCanvas"></canvas>
<input id="pptx-input" type="file" accept=".pptx" />
<button id="prev">Prev</button>
<button id="next">Next</button>
<div id="status"></div>
<script src="PptxViewJS.min.js"></script>
<script>
const { mountSimpleViewer } = window.PptxViewJS;
mountSimpleViewer({
canvas: document.getElementById('myCanvas'),
fileInput: document.getElementById('pptx-input'),
prevBtn: document.getElementById('prev'),
nextBtn: document.getElementById('next'),
statusEl: document.getElementById('status')
});
</script>Need finer control? You can still instantiate new PptxViewJS.PPTXViewer() manually and use the same APIs shown above.
That's really all there is to it!
Navigate through presentations with simple, chainable methods:
// Navigate through slides
await viewer.nextSlide(); // Go to next slide
await viewer.previousSlide(); // Go to previous slide
await viewer.goToSlide(5); // Jump to slide 5
// Get information
const currentSlide = viewer.getCurrentSlideIndex();
const totalSlides = viewer.getSlideCount();Listen to presentation events for custom interactions:
// Listen to events
viewer.on('loadStart', () => console.log('Loading started...'));
viewer.on('loadComplete', (data) => console.log(`Loaded ${data.slideCount} slides`));
viewer.on('renderComplete', (slideIndex) => console.log(`Rendered slide ${slideIndex}`));
viewer.on('slideChanged', (slideIndex) => console.log(`Now viewing slide ${slideIndex}`));Thank you to everyone for the contributions and suggestions! โค๏ธ
Special Thanks:
- Alex Wong - Original author and maintainer
- gptsci.com - Project sponsorship and development
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.
Copyright ยฉ 2025 Alex Wong