npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@s8fy/pptx-viewer

v3.17.0

Published

Browser PowerPoint (PPTX) viewer SDK with local rendering, a Web Component, supported animations and PDF export

Readme

@s8fy/pptx-viewer

Product · Documentation · Viewer playground · Commercial licensing · Report an issue

High-fidelity PowerPoint viewing in the browser, with a framework-neutral SDK and native Web Component.

Built on the shared @s8fy parser, model, and DOM/SVG renderer pipeline, with font-driven text layout, vector graphics, charts, and supported DrawingML effects. The package provides the framework-neutral viewer controller, a native custom element, parser/PDF helpers, and the stylesheet required by the default viewer UI.

Key Features

  • Data-driven 2D, 3D, and modern Office charts. Rendering paths cover column/bar, line, area, pie/doughnut, scatter, bubble, radar, and stock charts, plus Waterfall, Funnel, Histogram, Treemap, Sunburst, and Box & Whisker. Coverage of formatting and layout options varies by family. Supported 3D column/bar, line, area, pie, and surface charts use projected geometry, camera settings, depth ordering, and shaded faces; surface charts support value bands and wireframes. Lighting includes approximations and does not reproduce every Office rendering detail.
  • Chart formatting that goes beyond the series. Supported chart paths account for authored axes, number formats, labels, legends, missing values, stacking, and series/point styling. Selected 2D combinations retain multiple chart groups and secondary axes. 3D charts are drawn from their chart data and authored scene settings.
  • Text layout driven by fonts and DrawingML. Mixed run styles, paragraph spacing, bullets and numbering, indentation, tabs, character spacing, kerning thresholds, and supported East Asian line-break rules participate in layout. Mounted text can reflow after fonts load. Optional embedded-font extraction and explicit font sources help preserve authored typography when usable fonts are available; extraction alone does not guarantee that a font can be loaded or used.
  • SmartArt with two rendering paths. Cached SmartArt drawings are preferred. Selected uncached linear-process and organization-hierarchy layouts are projected into shapes with inherited text styling and font-driven fitting, including supported node animation targets.
  • Authored animations and slide transitions. Play supported entrance, exit, and emphasis effects with click/with-previous/after-previous timing, repeat and auto-reverse. Selected 2D column/bar charts expose series/category/point targets; selected 2D line/area charts expose series targets. Combination layers and charts with trendlines or error bars do not expose these subtargets. Supported SmartArt nodes can animate independently. Box and dissolve effects, selected P14 transitions, and Morph object/word/character matching have dedicated playback paths; unsupported variants retain their applicable fallback.
  • DrawingML graphics and effects. Vector shapes, custom geometry, image crops/fills, tables, glyph outlines/glow/reflections, shape inner shadows/reflections, and selected shape 3D and solid 3D text profiles share the DOM/SVG/CSS renderer. Supported Office equations are typeset with KaTeX; EMF/WMF fallback graphics can be displayed through the parser's SVG conversion.
  • Presentation behavior, ready to embed. Slide navigation, fullscreen, presenter mode, configurable looping autoplay, authored internal slide links, and Last Slide Viewed are built in. Sequential navigation skips authored hidden slides while explicit targets remain addressable. Audio/video controls depend on playable media, browser support, and user interaction.
  • Local preview and PDF export. Load PPTX bytes from a file picker or your own storage without a third-party conversion upload. Parsing prefers Workers; PDF conversion runs in a terminable Worker. Self-host the runtime assets and fonts, and disable remote font fallback for offline deployments. PDF export requires original PPTX bytes and produces static pages.
  • One engine across application stacks. Use the framework-neutral TypeScript SDK, native Web Component, or React/Vue/Svelte/Solid adapters with the same rendering capabilities, font options, playback controls, and export APIs. Resource cleanup is part of the viewer lifecycle.

Support is feature-specific: font availability, browser capabilities, and the authored Office variant affect the result. Unsupported SmartArt layouts, effects, and transition variants use their applicable fallback; this is not a promise of complete PowerPoint pixel parity. WASM parsing/PDF needs WebAssembly GC; JS parsing is available separately. Commercial use requires a commercial license, and runtime authorization can require watermarks or restrict operations. The sections below describe configuration and support boundaries.

Testing and fidelity validation

  • 7,000+ automated test cases across the Viewer SDK, framework adapters, and related shared parsing/rendering/export components help guard against regressions.
  • Tested on 500+ real presentation decks, alongside targeted automated fixtures, to evaluate layout and rendering in authored documents.
  • A proprietary fidelity workflow developed in-house supports ongoing rendering improvements and regression prevention alongside automated suites and real-deck testing.

Which package should I use?

| Goal | Package | | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | Display and present a PPTX in a browser | @s8fy/pptx-viewer | | Integrate with React, Vue, Svelte, or Solid | The matching Viewer adapter plus @s8fy/pptx-viewer; see framework integrations | | Convert PPTX to PDF or Markdown without a viewer UI | @s8fy/pptx-converter, with its own license | | Read low-level slide and element data | @s8fy/pptx-parser | | Work with normalized models and shared font/PDF helpers | @s8fy/pptx-core | | Render normalized models into a browser DOM | @s8fy/pptx-renderer | | Convert standalone EMF/WMF graphics to SVG | @s8fy/emf2svg |

Viewer and Converter are separate products. Their APIs and licenses are not interchangeable.

Install

pnpm add @s8fy/pptx-viewer

Usage

import { createPptxViewer } from '@s8fy/pptx-viewer'
import '@s8fy/pptx-viewer/style.css'

const root = document.querySelector('#viewer')
if (!(root instanceof HTMLElement)) throw new Error('Missing #viewer element')

const viewer = createPptxViewer(root)
try {
  const response = await fetch('/slides.pptx')
  if (!response.ok) throw new Error(`PPTX request failed: ${response.status}`)
  await viewer.load(await response.arrayBuffer(), 'slides.pptx')
  console.log(`Loaded ${viewer.total} slides`)
} catch (error) {
  viewer.destroy()
  throw error
}
// Call viewer.destroy() when your route/component is disposed.

The controller returned by createPptxViewer() owns parsing, slide navigation, rendering, and cleanup for a single mount node.

Add <div id="viewer"></div> to the page and serve a PPTX at the example URL. For a file input, pass await file.arrayBuffer() to load; File, URL strings, and Node Buffer objects are not viewer source values.

Pass one source ({ kind: 'file', file, fileName? } or { kind: 'presentation', presentation }), or omit it for an empty viewer. The retired top-level source fields are rejected. await viewer.load(file) and await viewer.setData(presentation) wait for authorization, font preparation with its existing timeout/fallback, and the first DOM commit. setData removes original-file export capability. File inputs are snapshotted before any asynchronous work. Pending operations reject immediately when superseded or destroyed; ViewerOperationError.code distinguishes invalid_source, missing_document_source, operation_superseded, and viewer_destroyed.

The default configuration uses the WASM parser and unzip engine, a 960 px viewer width, enabled PDF export and presenter mode, and disabled PPTX download. The package ships the parser workers, WASM binaries, viewer CSS, and cacheable KaTeX WOFF2 font assets through its dependency graph; modern bundlers such as Vite preserve them automatically.

The ESM and CJS modules can be imported during SSR without browser globals. Creating a viewer, registering the custom element, or rendering slides still requires a browser DOM; definePptxViewer() is a no-op when customElements is unavailable.

Compare 2–4 presentations

Use the independent compare entry for synchronized, side-by-side page viewing:

import { createPptxCompareViewer } from '@s8fy/pptx-viewer/compare'
import '@s8fy/pptx-viewer/style.css'

// Give the host a definite height, e.g. <div id="compare" style="height: 720px"></div>.
// files is a File[] obtained from a multiple file input; select 2–4 PPTX files.
const host = document.querySelector<HTMLElement>('#compare')!
const documents = await Promise.all(
  files.map(async (file, index) => ({
    id: `doc-${index + 1}`,
    label: file.name,
    source: { kind: 'file' as const, file: await file.arrayBuffer(), fileName: file.name },
  })),
)
const compare = createPptxCompareViewer(host, { documents })
const unsubscribe = compare.subscribe((event) => {
  if (event.type === 'error') console.error(event.error)
})
try {
  const state = await compare.whenSettled()
  // Settled includes partial failures; inspect documents and cells before proceeding.
  console.log(state.documents)
} catch (error) {
  console.error(error)
}
// On disposal: unsubscribe(); compare.destroy().

Two documents use equal columns; three or four use an equal 2×2 grid, with the fourth cell empty for three documents. Continuous mode supports two documents only. Compare offers index alignment, custom page groups, and optional two-document text matching; it does not compute or highlight element differences. PDF/PPTX export requires a ready original-file source, and all authorization and watermark policies still apply.

React, Vue, Svelte, and Solid adapters have matching /compare subpaths. Import @s8fy/pptx-viewer/compare/web-component to register only <s8fy-pptx-compare-viewer>; the ordinary root entry does not export the compare runtime. See the Compare usage guide (Chinese) for a complete file-input example, events, lifecycle, alignment, export, and framework integration details.

Annotate a presentation

Enable annotations: true when creating a Viewer for an original PPTX. The Notes mode button opens the current slide for selection using the loaded presentation. Click an object, then click it again or choose Add note. With focus on the canvas, use the arrow keys to select a drawing and Enter to add a note. Alt+Click cycles overlapping objects and Shift-drag selects an area. Save a note directly on the object, or open Quote text, select a passage within one paragraph, and choose Use selection. The quote and its paragraph and character offsets are included in the exported notes.

import { createPptxViewer } from '@s8fy/pptx-viewer'

const viewer = createPptxViewer(hostElement, { annotations: true })
await viewer.load(pptxBytes, 'slides.pptx')
await viewer.setAnnotationMode(true)
// Read the current file's annotations after the user saves a note.
const json = await viewer.exportAnnotations()

The Collect notes icon appears next to Notes mode when the document has saved notes. It can copy or download the same versioned JSON, with physical page and drawing identity, the original content, and the note. The Viewer retains notes by the SHA-256 of the original file for the lifetime of that Viewer instance. Annotation mode displays a static slide and restores the requested browse layout on exit. It uses the browser's Web Crypto API to identify the original bytes.

The native element accepts the annotations attribute and the same two methods. Hosts can use ViewerAnnotationOptions to mount the collection panel in their own container and supply optional Writer verification or Markdown context.

Review a presentation

Use @s8fy/pptx-viewer/workspace to browse an accepted snapshot and show a proposed edit next to it. The workspace owns rendering, keyboard navigation, and selections. Add @s8fy/pptx-review and @s8fy/pptx-writer to verify targets and stage edits. Add @s8fy/pptx-converter for PDF or Markdown export.

import { createReviewSession } from '@s8fy/pptx-review'
import { createWriter } from '@s8fy/pptx-writer'
import { createWorkspaceViewer } from '@s8fy/pptx-viewer/workspace'

const writer = createWriter()
const session = createReviewSession({ writer })
const snapshot = await session.load(pptxBytes)
const workspace = createWorkspaceViewer(hostElement, {
  base: { id: 'original', snapshot, file: session.copySnapshot(snapshot.id) },
  mode: 'review',
})
await workspace.whenSettled()
// On unmount: workspace.destroy(), session.destroy(), writer.dispose().

Workspaces require browser Workers. Use subscribe() for pane status and pass current hits through session.verifyHit(hit, workspace.isCurrentHit.bind(workspace)) before offering edits. Shift-drag selects a region for an annotation. Use selectRegion() for a keyboard-accessible or host-supplied selection and setAnnotations() to display notes. Coordinates are fractions of the physical slide. For the native element, import @s8fy/pptx-viewer/workspace/web-component, add <s8fy-pptx-workspace-viewer>, and set its options property to the same options object.

Rendering capabilities

The facade and Web Component share the same Core/Renderer implementation. They display supported native SmartArt layouts, chart/SmartArt animation subtargets, Box animations and dissolve transitions, glyph glow/reflections, shape reflections/inner shadows, solid 3D text, and authored audio posters. SmartArt cached drawings take precedence; native projection covers selected uncached linear-process and organization-hierarchy layouts. Audio controls depend on playable media and browser support, and playback requires user interaction.

Font availability, connected layout, browser capabilities, and effect budgets affect rendering. Unsupported effects/layouts retain their applicable fallback rather than guaranteeing Office pixel parity. PDF export uses a separate static renderer: audio posters do not play audio, and shape-frame reflections require zero blur. See the renderer README for playback and effect details.

Common options

| Option | Default | Usage | | ------------------------ | ------------------------- | ---------------------------------------------------------------------------- | | source | Empty viewer | One explicit file or normalized presentation source | | parser, unzipMode | 'wasm', 'wasm' | Select JS/WASM parsing and the WASM parser's ZIP engine | | wasmUrl | Package-relative | Override the parser WASM URL | | width, initialSlide | 960, 0 | Viewer width in pixels and zero-based starting slide | | viewMode | 'single' | 'continuous' stacks every slide vertically; see below | | lazy, lazyRootMargin | true, '100% 0px' | Continuous view: render slides near the viewport, and how far ahead | | autoPlay | false | Automatically cycle through visible slides after loading | | autoPlayInterval | 5000 | Autoplay delay in milliseconds; invalid/non-positive values use the default | | toolbarClassName | — | Extra classes on the built-in toolbar | | locale | Document/browser language | en-US or zh-CN; unsupported locales fall back to English | | enableShortcuts | true | Show the keyboard shortcuts panel button | | hideToolbar | false | Hide the built-in toolbar | | extractFonts | false | Extract embedded fonts for preview; can increase memory use | | enablePdfExport | true | Show PDF export UI; authorization still applies | | enablePptxDownload | false | Show original PPTX download UI | | enablePresenterMode | true | Enable presenter mode | | fonts | Default font resolution | Browser preview font sources; see below | | pdf | Default PDF settings | PDF engine/Worker URLs and font options | | license | No supplied license | { signedLicense, deploymentId?, signedRestrictionPolicies? } | | watermark | Policy-dependent | Additional watermark configuration; cannot remove required policy watermarks |

onLoad({ total }) runs when a document is ready, onSlideChange(index) receives a zero-based index, onPlaybackChange(playing) reports interactive playback starting or stopping, onLicenseStateChange(state) reports authorization state/reason, and onError(error) reports operation failures once. Explicit asynchronous methods still reject their returned Promise; callers must handle it even when onError is configured. Expected cancellation and calls after destruction do not emit error notifications. Callback throws/rejections cannot change an operation's outcome, and replacing or destroying a document suppresses its remaining callbacks. Initial source loading is asynchronous but creation returns immediately; use onLoad or create an empty viewer and await load() when readiness matters.

Continuous view

Set viewMode: 'continuous' to stack every slide in one vertical column instead of paging one slide at a time. Each slide keeps the ordinary-view scale (shrunk only when the column is narrower), so unrendered pages reserve their exact size and the scroll position never jumps:

const viewer = createPptxViewer(root, {
  viewMode: 'continuous',
  lazy: true, // default: render slides as they approach the visible area
  lazyRootMargin: '100% 0px', // default: extend above/below by 100% of the root's width
})
viewer.setViewMode('single') // switch layouts later without reparsing
viewer.setViewMode('continuous', { lazy: false }) // render every slide up front

createPptxViewer returns PptxViewerController. It inherits viewMode and setViewMode from ViewerController and provides startCustomShow. A layout switch returns false if rejected or superseded by a callback. An invalid lazy margin also reports the error through onError. Existing custom Viewer implementations do not need layout or named-show controls, and custom ViewerController implementations can omit startCustomShow. Framework callbacks and refs retain the base Viewer type; narrow or type a built-in viewer as PptxViewerController when accessing these controls on it.

lazy: false, or a browser without IntersectionObserver, renders every slide when the document is shown. Rendered lazy slides stay mounted until the layout or document changes. The most visible slide becomes slide and is reported through onSlideChange; setSlide, Prev/Next, keyboard and authored slide links scroll to their target. The continuous view shows hidden slides (dimmed), so sequential navigation and Home/End step through physical slides. It has no timed autoPlay advance. Fullscreen, Presenter View and play() still use the single-slide stage; pausing or finishing inline playback returns to the continuous view at the slide reached. Both parser engines produce the same model, so the layout behaves identically with parser: 'js' and 'wasm'. Framework adapters switch viewMode/lazy prop changes in place; a different lazyRootMargin recreates the viewer.

Where the slides scroll follows the host's CSS, with no extra option:

  • Unconstrained height (default): the viewer grows with its slides and the page scrolls. The built-in toolbar stays pinned to the bottom of the window. Set --s8fy-continuous-offset on a parent to clear sticky page headers when a slide is scrolled into view.
  • Constrained height: give the container a definite height (for example a 600px panel, or height: 100% inside a sized layout), or set height/max-height on the viewer element. The viewer stays inside that box. When the column overflows the stage, it scrolls internally, the toolbar stays at its bottom, and navigation scrolls only the viewer, never the page. Lazy loading and the current slide are then measured against that inner scroller. If a short document fits without overflowing, it keeps page scrolling and navigation may scroll the surrounding page to the selected slide, even with a fixed-height host. If the column is narrower than the viewer width, for example because of a classic scrollbar, slides are scaled down to fit instead of being clipped.

lazyRootMargin uses the native IntersectionObserver syntax. Percentages use the root's width, including top/bottom margins; use px for a fixed pre-render distance. The root is the stage while it scrolls internally, otherwise the viewport. Invalid syntax rejects a lazy continuous-mode document load and reports through onError. An in-place switch to lazy continuous mode instead reports through onError and preserves the existing layout and playback. Eager rendering and browsers without IntersectionObserver do not use the margin.

Constraining or releasing the height later (including through a resize) switches the scroller in place and keeps the current slide in view while the viewer is visible. Offscreen viewers refit without scrolling the surrounding page; explicit navigation still scrolls to its target. When the inner scroller reaches its end, the browser continues scrolling the page as usual; set overscroll-behavior: contain on .s8fy-pptx-stage to prevent that. Use --s8fy-continuous-gap to change the spacing between slides.

Automatic deck playback

For an unattended display, enable autoplay before loading the deck:

const viewer = createPptxViewer(root, {
  autoPlay: true,
  autoPlayInterval: 3000,
})
await viewer.load(await file.arrayBuffer(), file.name)

Autoplay starts after the document is ready, from initialSlide. It works inline, in fullscreen, and in presenter mode, including when animations are disabled. The interval starts after the page transition and automatic animation segments finish; pending click-triggered builds do not block changing pages. Autoplay overrides the PPTX's authored advance timing, skips hidden slides, and loops from the last visible slide to the first. A single visible slide does not keep a timer. autoPlayInterval accepts finite positive numbers in milliseconds and defaults to 5000. Setting the interval alone does not enable autoplay.

Selecting a different slide restarts its interval. resetAnimations() stops automatic playback until navigation to another slide or a new document. Loading another document cancels the old timer; destroy() releases it. This setting controls page changes separately from autoPlayAnimations and does not enable audio/video playback. React, Vue, Svelte and Solid adapters accept the same options.

For the Web Component, use auto-play and auto-play-interval="3000" attributes, or its autoPlay and autoPlayInterval properties before loading.

Navigation and export

For user-controlled playback, call viewer.play() after loading, and viewer.pause() to pause. viewer.playing and onPlaybackChange(playing) report its state. play({ interval: 3000, loop: false }) uses each slide's authored advance time (including zero), or the positive fallback interval (default 3000ms). The dwell starts after the transition and all supported animation segments, including click builds, finish. Hidden slides are skipped; after the final dwell playback stops by default. loop: true loops visible slides. This is separate from the existing looping autoPlay option; an explicit playback session takes precedence, including while paused. After playback stops by itself at the end, the next play() restarts from the first visible slide; if the page was changed in between, or playback was paused manually, play() continues from the current page instead. Options passed to play() while already playing update the session: loop takes effect when the current dwell ends and interval from the next dwell, without restarting the running dwell.

Playback works inline with the default fullscreen animation scope. animate: false, static/never animation policies and reduced-motion preferences still apply. It does not request fullscreen or start audio/video. Request fullscreen in a click handler before calling play(), and fall back to inline playback if the request fails. Pausing freezes active builds and settles an in-flight page transition. Resuming retains build progress and restarts the dwell. Explicit next-build commands remain usable while automatic playback is paused. Non-navigation rerenders, including fullscreen changes and resizing, retain build progress without replaying animation-start callbacks. Navigation starts fresh builds on the selected page and restarts the dwell when playing; paused navigation stays paused. Source replacement, destruction, leaving native fullscreen, and hiding the document stop playback. Visibility/fullscreen return does not resume it automatically. Starting a manual slideshow or presenter view ends the interactive playback session. A single visible slide can replay its builds with loop: true. A single visible slide with zero authored dwell and no timed builds or transition uses the positive fallback interval, avoiding a continuous redraw of static content.

Web Component equivalents are play(options?), pause(), playing, and a playbackchange event with { playing } detail. Unsupported effects and media autoplay remain subject to browser and renderer limitations.

| Controller API | Result | | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | slide, total | Zero-based current index and slide count | | setSlide(index), next(), prev() | Navigate slides; next() first advances a pending click animation when enabled | | viewMode, setViewMode(mode, { lazy? }) | Read or switch the single/continuous layout in place | | load(buffer, fileName?), setData(presentation) | Promise<void> for document replacement | | toPdf(options?) | Promise<Uint8Array>; no download | | downloadPdf({ fileName?, ...options }?) | Promise<void> after conversion and browser download initiation | | downloadPptx(fileName?) | Promise<void> after original-file download initiation | | enterFullscreen() | Promise<void> after the native fullscreen request succeeds | | enterPresenterMode(), exitPresenterMode(), togglePresenterMode() | Presenter controls | | destroy() | Release owned Blob URLs/fonts, listeners, and pending work |

PDF/PPTX export requires a successfully loaded original file. A model-only source cannot reconstruct those bytes. Await load() before exporting and handle promise rejection. A completed download method means the download was initiated, not that the file has finished writing to disk.

setSlide(index), initialSlide, and slide-change callbacks use physical zero-based indexes, including hidden slides. Sequential navigation, Home/End, and timed advance skip slides marked hidden; explicit selection and static export retain them. Next controls remain available while a transition or animation build can still advance, including on the last slide.

Authored internal links use Slide.sourcePart to identify their destination, and Last Slide Viewed returns to the previously visited slide. Missing targets are inert. Synthetic or previously saved models may omit sourcePart and hidden; omitted hidden metadata means visible. Preserve part identities when rearranging parsed slides to keep authored links valid.

Invoke enterFullscreen() directly from a user interaction and handle its rejection. A missing browser API rejects with DOMException name NotSupportedError. Source replacement does not cancel a fullscreen request; destruction rejects it immediately and cleans up only this viewer's fullscreen session, including late native completion.

Leaving native fullscreen also exits Presenter View and restores the configured preview mode at the current slide.

The top-level pptxToPdf(buffer, options?) and downloadPdf(bytes, fileName) helpers are also exported. They are different from controller methods: the standalone download helper takes existing bytes, and standalone conversion does not accept the controller's fontResolver option.

Keyboard navigation

Click the slide surface or Tab to the viewer region before using shortcuts. Embedded previews handle navigation only while focused; fullscreen and presenter views also handle document-level keys. Opening Presenter View, including through the imperative API, moves focus into the viewer.

| Action | Windows-style shortcut | macOS shortcut | | ------------------------------------------------------ | -------------------------------------- | ------------------------- | | Start slide-only fullscreen at the first visible slide | F5 | Command+Shift+Return | | Start slide-only fullscreen at the current slide | Shift+F5 | Command+Return | | Open Presenter View at the current slide | Alt+F5 | Option+Return | | Next build/visible slide | Right, Down, PageDown, Space, Enter, N | Same; Fn+Down is PageDown | | Previous visible slide (no animation rewind) | Left, Up, PageUp, Backspace, Delete, P | Same; Fn+Up is PageUp | | First / last visible slide | Home / End | Fn+Left / Fn+Right | | Exit fullscreen / Presenter View | Escape | Escape |

Native fullscreen requires browser support and permission; failures notify onError. enablePresenterMode: false disables the Presenter View bindings, not slide-only fullscreen. Inputs, editable text, buttons, links, media, and ARIA controls keep their keyboard behavior. Escape can still exit a show unless the event was already handled or is part of IME composition. Other modified navigation (including Ctrl+F5), handled events, and IME keystrokes are left to the host.

Animation model since 3.2

The facade and framework adapters use Core's animation model. AnimationDegraded is a discriminated union with required kind. Since 3.2, narrow on text-granularity or timing-fill before reading that variant's fields; the former effect-fallback variant and AnimationEffect.previewFallback are removed. These incompatible type changes intentionally shipped in a minor version while the SDK had no external consumers. Add kind: 'text-granularity' to application-created text diagnostics, replace interface extension/declaration merging against the former interface, and reparse original PPTX bytes when migrating persisted models.

Supported dissolve entrance/exit element effects play deterministic particles, preserving authored opacity and timing. They do not use a fade fallback. Repeat, reverse, replay and interrupted-slide snapshots share the object animation lifecycle. PDF export remains static; particle playback does not imply PowerPoint frame equivalence.

The viewer follows native Slide and Section Zoom in fullscreen, Presenter View, and inline slideshow playback. Set animationScope: 'always' to enable Zoom in the single-slide view. Continuous view uses ordinary slide links. Slide.zooms contains SlideZoom entries bound to shapes from the slide itself. Each entry reports its target part names in visit order, whether to return to the parent, and an optional duration in milliseconds. Section Zoom visits its targets in order. With return disabled, playback continues from the last target. Zero cuts immediately. An omitted duration uses the destination slide's transition.

Start a standalone named show in its authored order with viewer.startCustomShow(id) or the equivalent Web Component method. The ID comes from PptxPresentation.customShows, whose members use the same part identities as internal slide links. Call the method from a user interaction to allow fullscreen. When fullscreen is unavailable, the show runs inline and keeps its authored timing, text hover actions, and canvas clicks for ordinary builds. Escape leaves the active inline show.

Linked custom shows can return to the calling slide after the last member, and normal navigation resumes from that slide. A link to another member of the active show keeps the show and its return slide.

Upgrading to 3.0

Replace calls to the removed viewer.fullscreen() alias with viewer.enterFullscreen() and handle its returned Promise<void>. Invoke it in the user interaction handler so the native request retains user activation. The ViewerBinding root re-export has also been removed; create application controllers with createPptxViewer. The /internal lifecycle bridge is for SDK integrations, not a stable application API.

Fonts, deployment, and animation

For self-hosted browser fonts and PDF fallback fonts, pass options such as:

import type { ViewerOptions } from '@s8fy/pptx-viewer'

const options: ViewerOptions = {
  fonts: {
    remoteFonts: false,
    families: { 'Noto Sans SC': '/fonts/NotoSansSC-Regular.ttf' },
  },
  pdf: {
    fontResolver: false,
    unicodeFallbackFont: { url: '/fonts/NotoSansSC-Regular.ttf' },
  },
}

Serve the font at the supplied URL. Preview font resolution may use Google Fonts by default; remoteFonts: false disables that fallback while retaining explicitly configured assets. fonts: false disables remote preview fallback but does not prevent embedded-font injection. PDF fonts require font bytes; preview CSS alone is not sufficient. pdf.fontResolver: false skips automatic PDF font resolution while explicit font options remain usable.

For user-approved local PDF font bytes, use pdf: { fontResolver: { systemFonts: true, remoteFonts: false } }. This is an export-time setting, not a fonts preview option. It requires a supporting browser, a secure context, permission, and supported installed TrueType fonts; provide explicit fallback fonts for unavailable or denied access. Exact fonts are preferred, with compatible Calibri/Carlito and Arial/Arimo fallbacks where available.

Version 3.2 replaced createPdfFontOptions / PdfFontOptionsInput with the facade export resolvePdfFonts(input: PdfFontResolutionInput): Promise<PdfFontResolutionResult>, without a compatibility alias or the unused embeddedFonts input. This API change intentionally shipped in a minor version while the SDK had no external consumers. It returns { fonts, cjkFallback }. Inspect cjkFallback.status, then pass viewer.downloadPdf({ ...result.fonts, fontResolver: false }); passing the whole result is incorrect. This API has been published since 3.2.0 and is not available in 3.1.0.

The report distinguishes not-checked (no model), not-needed (no visible CJK), missing, partial, complete, and unknown coverage. It exposes required, covered, missing and unknown codepoint lists, plus coverageSources: inspected Unicode cmap mappings or declared CSS unicode-range coverage for downloaded faces. Ordinary family fonts and Latin/symbol fonts do not count as CJK fallbacks. Partial Google downloads therefore cannot be mistaken for complete CJK coverage, and symbol-only success remains missing. WOFF2/TTC with no inspectable coverage and unloaded explicit fallback URLs remain unknown.

Automatic Viewer export keeps tolerant resolution; the report does not itself reject downloads. Applications requiring a complete CJK fallback should only accept complete/not-needed, avoid caching rejected results, preserve retry, and check document identity before downloading. Embedded/original fonts are outside this fallback report, so missing does not prove the final PDF lacks glyphs. Even complete is not a font-validity, shaping or fidelity guarantee; CSS coverage is not decoded glyph verification. Prepare the model/imports before requesting local fonts directly in an export click.

Default package assets need no custom URLs in the tested Vite integration. If using copied/CDN assets, wasmUrl selects the parser binary; pdf.wasmUrl selects pdf-converter.wasm, and pdf.workerUrl selects its Worker. Keep asset paths intact, serve WASM rather than HTML fallback content, and allow cross-origin requests when applicable. Browser PDF conversion requires a working Worker and does not retry synchronously after Worker failure.

animationScope defaults to 'fullscreen' (including presenter mode); use 'always' for inline playback or 'never' to disable it. animationMode: 'static' and animate: false disable playback. Reduced-motion preferences are respected unless animate: true is supplied. autoPlayAnimations is off by default and clickToAdvanceAnimation is on. nextAnimation(), completeAnimations(), resetAnimations(), onAnimationStart, and onAnimationEnd control/report supported effects; unsupported PowerPoint effects are not guaranteed to reproduce exactly.

With animation playback enabled, authored trigger shapes respond to clicks independently of the ordinary builds. In fullscreen and Presenter View a click on the canvas or an unbound shape advances an ordinary build when clickToAdvanceAnimation is enabled. Keyboard and Presenter Next controls use the ordinary sequence. Host play() runs the ordinary sequence followed by the shape-triggered sequences in source order.

Errors and runtime support

The package declares Node.js 22.12+ and supplies ESM/CJS TypeScript declarations. WASM parsing/export needs WebAssembly GC; choosing parser: 'js' changes parsing only, not the PDF engine. In SSR frameworks, create/mount the viewer in client-side lifecycle code.

Catch ViewerOperationError and inspect code for lifecycle/source failures. AuthorizationDeniedError.reason, PptxFileSizeLimitError.limitBytes, and ResourcePolicyError.details distinguish authorization, file-size, and engineering resource-limit failures. UI flags do not grant an entitlement, and commercial licenses do not disable engineering resource limits.

Built-in toolbar export and fullscreen failures keep the current presentation visible and show an accessible error alert. Navigation, a new toolbar operation, or source replacement clears the alert. Document loading and rendering failures use the stage error view instead.

Custom Element

Register the element once before using <s8fy-pptx-viewer> in markup:

import { definePptxViewer } from '@s8fy/pptx-viewer/web-component'
import '@s8fy/pptx-viewer/style.css'

definePptxViewer()
<s8fy-pptx-viewer id="deck" width="960" enable-pdf-export="false"></s8fy-pptx-viewer>

After the element is connected to the document, load a file through its method or source property:

import { PptxViewerElement } from '@s8fy/pptx-viewer'

const element = document.querySelector('#deck')
if (!(element instanceof PptxViewerElement)) throw new Error('Viewer is not registered')
element.addEventListener('slidechange', (event) => {
  console.log((event as CustomEvent<{ index: number }>).detail.index)
})
const response = await fetch('/slides.pptx')
if (!response.ok) throw new Error(`PPTX request failed: ${response.status}`)
await element.load(await response.arrayBuffer(), 'slides.pptx')

Use view-mode="continuous", lazy="false" and lazy-root-margin attributes for the continuous view. Changing view-mode or lazy, or calling element.setViewMode(mode, { lazy? }), switches the layout in place; element.viewMode reads it. A rejected switch preserves the previous layout attributes and emits an error event.

Importing ./web-component alone does not register the element: call definePptxViewer(). There is no file-fetching src attribute. Set structured source, license, fonts, and pdf values as JavaScript properties; the retired file, presentation, and fileName properties and file-name attribute are rejected. Methods such as load, setData, toPdf, and downloads require a connected element. Removing it from the DOM destroys its controller automatically.

Events are load (detail: { total }), slidechange ({ index }), playbackchange ({ playing }), licensestatechange (license state), animationstart/animationend (playback event), and error ({ error }). Listen directly on the element; these events do not bubble. For boolean attributes, only the exact value "false" is false; any other present value is true, and removing an attribute restores its default. Configuration property/attribute changes recreate the controller.

For a connected element, invalid load()/setData() inputs dispatch error and reject the returned Promise; handle the rejection even if an event listener is installed. Assigning source is not awaitable and reports failures through events. Source updates reuse the controller, while clearing the source or changing configuration recreates it.

The element forwards loading, navigation, animation, presenter, and export methods, but does not expose the controller's enterFullscreen() method. Use the SDK controller when that imperative fullscreen API is required.

Package Boundaries

@s8fy/pptx-viewer is intentionally thin:

  • PPTX parsing and PDF helpers come from @s8fy/pptx-core.
  • DOM/SVG rendering and viewer state are handled by @s8fy/pptx-renderer.
  • Framework packages wrap this same controller instead of reimplementing it.

Available framework wrappers:

  • @s8fy/pptx-viewer-react
  • @s8fy/pptx-viewer-vue
  • @s8fy/pptx-viewer-svelte
  • @s8fy/pptx-viewer-solid

Install both a framework adapter and @s8fy/pptx-viewer directly when the application imports @s8fy/pptx-viewer/style.css; the adapter READMEs include the exact commands.

Frequently asked questions

Can I preview PowerPoint files without uploading them?

@s8fy/pptx-viewer accepts PPTX bytes and parses/renders them in the browser. Your application supplies the file; the SDK does not need a third-party document conversion service. Runtime assets and configured fonts can still generate network requests, and remote font fallback is enabled by default.

Can the viewer work offline?

Yes, with locally available Worker/WASM/CSS/font assets and document resources. Disable remote preview font fallback with fonts: { remoteFonts: false }; configure PDF fonts separately if exporting. See Fonts, deployment, and animation. A self-hosted deployment does not automatically cache assets for offline use.

Does it support every PowerPoint effect and older .ppt files?

The documented input is OOXML .pptx; legacy binary .ppt is outside this SDK's documented input contract. Chart, SmartArt, animation, transition, and DrawingML support covers specific profiles. Unsupported content can fall back or be omitted; font differences can change layout.

Can I export a presentation model to PDF?

Viewer PDF export requires a successfully loaded original PPTX file. A source with kind: 'presentation' cannot reconstruct those bytes. Use Converter for a standalone PPTX-to-PDF or Markdown workflow; it has a separate API and license.

Can I use the viewer in a commercial application?

Companies can use the viewer for local development, testing, internal prototypes, and POC evaluation without registration or a separate evaluation agreement. Commercial production use requires a commercial license. See License for the terms and runtime authorization requirements.

License

This package is licensed under the Structurify Commercial & Evaluation License (see LICENSE). Free for local development, testing, POC evaluation, and noncommercial use; commercial production use requires a commercial license. Runtime license validation is separate from permission to use the software commercially.

Built-in toolbar appearance

Single-file and compare viewers share icon-only Tabler controls (v3.51.0, 1px stroke), hover/focus tips and a non-modal keyboard shortcuts panel. Single-file controls include play/pause, and stay synchronized with API playback changes and automatic completion. Page counters and compare document names remain text. Ordinary toolbars center page navigation and align other actions to the right; narrow host containers use separate rows. Escape closes help and returns focus; clicking outside dismisses it. Compare help lists only shortcuts supported by its current mode. No icon font or framework icon runtime is downloaded.

Set toolbarClassName: 'my-viewer-toolbar' and locale: 'zh-CN' in ViewerOptions; compare uses the same fields under view. The native single-file element accepts toolbar-class, locale and enable-shortcuts="false" attributes. React, Vue, Svelte and Solid accept the corresponding options.

Style that class with --s8fy-toolbar-bg, --s8fy-toolbar-fg, --s8fy-toolbar-border, --s8fy-toolbar-hover, --s8fy-toolbar-active and --s8fy-toolbar-focus. Custom stylesheets should follow the SDK stylesheet. hideToolbar: true still removes the built-in UI so the host can supply its own controls. Translations are maintained in the renderer's src/locales.json; locale selection is per instance and never changes global document language.

Fullscreen controls sit at the lower right in a near-black translucent capsule with round 44px controls and a 12px backdrop blur (customizable with --s8fy-toolbar-blur) and soft elevation. Browsers without backdrop-filter support and users requesting reduced transparency receive a solid background. The shortcuts panel uses --s8fy-shortcuts-bg (solid dark by default in fullscreen) for text legibility.

With the built-in toolbar available, F1 opens keyboard help (including from toolbar buttons), and Esc closes it. Compare single-group mode also accepts PowerPoint navigation aliases N/Enter/Space and P/Backspace/Delete; continuous mode preserves native scrolling. Existing F5/Shift+F5 and macOS presentation shortcuts enter fullscreen slide shows, rather than starting automatic playback. No new dedicated fullscreen, autoplay, view-mode or document-selection keys are assigned.