Skip to content

Vanilla JS Viewer Overview ​

pptx-vanilla-viewer is a zero-framework PowerPoint viewer: it renders .pptx slides in the browser with plain DOM and has no dependency on React, Vue, or Angular. Calling the factory function createPptxViewer(container, options) returns a viewer instance with an imperative API. The parsing engine (pptx-viewer-core) is bundled in; the shared render logic (ooxml-ui/pptx) is installed as a dependency.

The live vanilla demo is this package running without a framework.

What it provides ​

CapabilitySummary
Slide renderingText, shapes, images, groups, connectors, tables, charts, SmartArt (2D and opt-in 3D), media, ink, OLE, content parts, zoom links, and 3D models all render with dedicated renderers.
NavigationToolbar, thumbnail sidebar, keyboard navigation (arrows, PageUp/PageDown, Space, Home/End), speaker-notes panel.
PresentationFullscreen presentation mode via the real Fullscreen API (Esc exits), with media autoplay.
ThemingThe shared ViewerTheme system (--pptx-* CSS custom properties), including the vermilion presets. See Theming.
EditingBehind editable: insert, format, multi-select/group, arrange, inherited template editing, rich notes, undo/redo, and save/download. See Instance API.
ExportPNG, PDF, GIF, video, print, notes-page, and handout output.
AccessibilityElement semantics plus a presentation-wide accessibility checker with issue navigation.
ExtensibilityAn open element-renderer registry: register or override renderers per element type without forking. See Element Renderers.

Element coverage

For a precise list of what the underlying parser supports, and what is approximated, see Limitations.

Installation ​

bash
npm i pptx-vanilla-viewer

The core engine wrapper (pptx-viewer-core) is bundled in. The shared render layer (ooxml-ui/pptx), the engine (ooxml-core) and their runtime dependencies (including jszip and fast-xml-parser) are regular dependencies and install automatically. There are no framework peer dependencies; yjs (collaboration) and ai (assistant) are optional peers.

Quick example ​

ts
import { createPptxViewer } from 'pptx-vanilla-viewer';

const viewer = createPptxViewer(document.getElementById('host')!, {
	source: '/decks/quarterly.pptx', // URL, ArrayBuffer, Uint8Array, Blob, or File
	onLoad: ({ slideCount }) => console.log(`${slideCount} slides`),
});

viewer.next();
viewer.goToSlide(3);
await viewer.enterPresentation();

The container should have a size; the viewer fills it (width/height: 100%). See Getting Started for the full walkthrough.

No build step required ​

The package ships ESM and CJS builds. Because there is no framework, it also works from a plain <script type="module"> with an import map or a bundler-free CDN setup - anywhere modern JavaScript runs. Styles are injected automatically at construction time (a single <style id="pptx-vanilla-viewer-styles"> tag, scoped under the .pptxv root class); CSP-strict hosts can render the stylesheet themselves via getViewerCss().

Rendering philosophy: CSS, not Canvas ​

Like every binding in this monorepo, slides render as CSS-positioned HTML/SVG scaled with a CSS transform, not onto a Canvas. Text stays selectable and crisp at any zoom, and screen readers keep working. The tradeoffs are listed in Limitations.

Import paths ​

The package exposes these entry points (from package.json exports):

ts
// Root entry - createPptxViewer, the renderer registry, theme utilities
import { createPptxViewer } from 'pptx-vanilla-viewer';
// AI assistant entry - the recommended value for the `ai` option
import { createAiAssistant } from 'pptx-vanilla-viewer/ai';
EntryWhat it exports
pptx-vanilla-viewercreatePptxViewer, the element renderer registry, theme utilities, the session helpers and the public types (see Key exports).
pptx-vanilla-viewer/aicreateAiAssistant, the PptxAiAssistant handle type and the PptxAi* config types: the recommended way to pass ai (The /ai entry).
pptx-vanilla-viewer/i18n/fr, /i18n/es, /i18n/de, /i18n/zh-CNThe bundled locale dictionaries (translationsFr and so on).
pptx-vanilla-viewer/internalsThe slide-transition helpers and playTransitionOverlay, for a custom presentation surface (API). Not covered by semver.
pptx-vanilla-viewer/styles.cssThe stylesheet the viewer otherwise injects at runtime, for CSP-strict hosts (Theming).

Key exports ​

ExportKindPurpose
createPptxViewerfunctionFactory: mount a viewer into a container. See Getting Started.
PptxViewerOptions, PptxViewerCallbackstypeOptions and event callbacks. See Options & Callbacks.
PptxViewerInstancetypeThe returned handle. See Viewer Instance API.
PptxViewerSourcetypeArrayBuffer | Uint8Array | Blob | string (URL).
ElementRenderer, ElementRendererRegistrytypeRenderer extension surface. See Element Renderers.
createDefaultRegistryfunctionThe default renderer registry (all built-in renderers pre-registered).
createSlidesPanefunctionSlide thumbnail rail for a custom shell. See API.
renderSlideThumbnailfunctionOne slide drawn as the rail draws it. See API.
getViewerCssfunctionThe full stylesheet as a string, for CSP-strict hosts.
ViewerTheme, ViewerThemeColorstypeTheme configuration types. See Theming.
vermilionLightTheme, vermilionDarkThemeconstBuilt-in vermilion light/dark presets.
themeToCssVars, defaultCssVarsfunctionConvert a theme to --pptx-* CSS vars.
PptxHandler, PptxSlide, PptxElementtypeCore types re-exported for the getHandler() escape hatch.
AccountAuthConfig, ToolbarActionIdtypeTypes for the accountAuth and hiddenActions options.
rememberSessionDeck, restoreSessionDeck, forgetSessionDeckfunctionReopen the deck after a refresh.
renderToCanvasfunctionThe html2canvas-pro wrapper the built-in export uses.
PptxAiConfig, PptxAiConnection, ...typeTypes for the optional ai option.

Next steps ​

Released under the Apache-2.0 License.