@s8fy/pptx-converter
v1.11.0
Published
High-fidelity local PPTX to PDF conversion and structured Markdown export in browsers, Node.js, Bun and Deno with a bundled WebAssembly engine
Downloads
6,683
Maintainers
Keywords
Readme
@s8fy/pptx-converter
Product · Documentation · PDF guide · Commercial licensing · Report an issue
High-fidelity PPTX to PDF conversion and structured Markdown export, entirely on your users' device.
@s8fy/pptx-converter ships its conversion engine as WebAssembly and runs directly in the browser, Node.js, Bun, or Deno. Build a local file converter, add export to a web app, or process presentations in a server-side script with the same API.
Key Features
- Data-driven chart rendering in PDF. Classic chart families and supported modern Office charts have rendering paths, including Waterfall, Funnel, Histogram, Treemap, Sunburst, and Box & Whisker. Supported axes, labels, legends, point styles, and number formats participate in the rendered chart geometry and text; formatting and layout coverage varies by family.
- 3D charts with scene geometry. Supported column/bar, line, area, pie, and surface charts account for camera settings, depth layout, visible faces, and shading. Pie extrusion/explosion and surface bands/wireframes have dedicated paths. Lighting includes approximations; these static projections do not reproduce every Office rendering detail or provide interactive 3D controls.
- Fonts and text remain part of the document. Supported text and vector content are emitted as PDF text and geometry. Embedded font handling and explicitly supplied font bytes support styled text and Unicode output; provide suitable font coverage for CJK and other required scripts. Preview CSS fonts alone are not PDF font bytes.
- SmartArt, equations, and DrawingML effects. Render supported cached SmartArt content, selected uncached linear-process/organization-hierarchy layouts, supported Office math, glyph glow/reflections, shape inner shadows, selected shape 3D profiles, and solid 3D text. Shape-frame reflections currently require zero blur; some effects use raster masks. Unsupported layouts and effect combinations can fall back or be omitted.
- Structured Markdown with original image assets. Export slide text, tables, chart information, speaker notes, and image references, with referenced image bytes returned separately. Choose human-readable or AI-oriented detail and select a slide subset for either export format.
- The same local engine across runtimes. Browser, Node.js, Bun, and Deno use the bundled WASM engine. No installed PowerPoint/LibreOffice or conversion service is needed. Explicit fonts and locally available runtime assets allow offline operation without automatic font downloads or system-font scans.
- Bounded conversion lifecycle. Dedicated Workers support cancellation, timeout, queued-job cancellation, and disposal without detaching the caller's input buffers. Conversion failures do not require recreating the entire application.
PDF is a static output: it does not play animations, transitions, audio, or video. Rendering depends on available fonts and supported Office feature profiles; unsupported or ambiguous content uses its applicable fallback. The engine requires WebAssembly GC and working Workers. Unlicensed PDF carries a demo watermark; Markdown does not. Commercial use requires a separate commercial license.
Testing and fidelity validation
- 3,000+ automated test cases across the Converter SDK and related shared parsing, PDF, math, metafile, and Markdown components help guard against regressions.
- Tested on 500+ real presentation decks, alongside targeted automated fixtures, to evaluate conversion fidelity in authored documents.
- A proprietary fidelity workflow developed in-house supports ongoing conversion improvements and regression prevention alongside automated suites and real-deck testing.
Install
pnpm add @s8fy/pptx-converterFor Deno projects:
deno add npm:@s8fy/pptx-converterNode.js / Bun
import { readFile, writeFile, mkdir } from 'node:fs/promises'
import { dirname, join } from 'node:path'
import { pptxToPdf, pptxToMarkdown } from '@s8fy/pptx-converter'
const input = await readFile('slides.pptx')
const pdf = await pptxToPdf(input)
await writeFile('slides.pdf', pdf.data)
console.log(pdf.authorization) // product, state, reason, outputDisposition
const result = await pptxToMarkdown(input, { fileName: 'slides.pptx' })
await mkdir('output', { recursive: true })
await writeFile('output/slides.md', result.markdown)
for (const asset of result.assets) {
const path = join('output', asset.path)
await mkdir(dirname(path), { recursive: true })
await writeFile(path, asset.data)
}Node.js supports both ESM and require('@s8fy/pptx-converter'). Input can be an ArrayBuffer, Uint8Array (including Buffer), or Blob. Read file paths and URLs in your application before calling the API. Results contain bytes and strings; the package does not write files.
Markdown asset paths are relative to the .md file. Images retain their original package bytes and format.
Deno
import { pptxToMarkdown, pptxToPdf } from '@s8fy/pptx-converter'
const input = await Deno.readFile('slides.pptx')
const pdf = await pptxToPdf(input)
await Deno.writeFile('slides.pdf', pdf.data)
const result = await pptxToMarkdown(input, { fileName: 'slides.pptx' })
await Deno.mkdir('output', { recursive: true })
await Deno.writeTextFile('output/slides.md', result.markdown)
for (const asset of result.assets) {
const path = `output/${asset.path}`
await Deno.mkdir(path.slice(0, path.lastIndexOf('/')), { recursive: true })
await Deno.writeFile(path, asset.data)
}Run the example with read access to both the input and the installed package's bundled WASM asset, plus write access to the outputs:
deno run --allow-read --allow-write=slides.pdf,output convert.tsIf the project uses a local node_modules, read access can instead be narrowed to paths such as --allow-read=slides.pptx,node_modules. Projects that use Deno's global npm cache need to include the relevant cache path when narrowing the permission.
Deno uses the package's Node-compatible ESM entry, including node:worker_threads; there is no separate Deno implementation or main-thread fallback. Deno 2.9.6 has been tested against an installed npm tarball. If wasmUrl points to HTTP or HTTPS instead of the bundled local asset, also grant the required --allow-net host.
Browser
import { pptxToPdf, pptxToMarkdown } from '@s8fy/pptx-converter'
const file = document.querySelector<HTMLInputElement>('input[type=file]')!.files![0]!
const result = await pptxToPdf(file)
const url = URL.createObjectURL(new Blob([result.data], { type: 'application/pdf' }))
const link = document.createElement('a')
link.href = url
link.download = 'slides.pdf'
link.click()
URL.revokeObjectURL(url)
const { markdown, assets } = await pptxToMarkdown(file)Bundlers that recognize standard Worker URLs, such as Vite, emit separate Worker and WASM assets. For direct deployment, preserve dist/browser.js, dist/browser-worker.js, their referenced JS chunks, and dist/converter.wasm together. Use workerUrl and wasmUrl to relocate assets. Custom browser Worker URLs must satisfy the browser's same-origin and CSP requirements.
Keep relocated JavaScript, Worker, and WASM assets on the same package version. This release's internal bridge also carries a host-local field-display date, so update previously copied WASM binaries together with the SDK.
In browsers, a relative wasmUrl resolves against the page URL, so prefer a root-relative or absolute asset URL. Node.js, Bun, and Deno require an absolute file:, http:, or https: WASM URL, such as new URL('./assets/converter.wasm', import.meta.url). workerUrl only changes the browser Worker; server-side runtimes always use the packaged node-worker.js.
Conversion does not upload presentations or contact a licensing service. Browsers load the deployed Worker/WASM assets, and an HTTP wasmUrl also causes an asset request.
PDF conversion refreshes supported short-date fields (datetime1, datetime, and date) using the field language and one host-local calendar snapshot captured when the conversion starts. Fixed dates and unsupported fields keep their cached text. This display snapshot does not change the authorization clock or add a caller-controlled date option.
The engine requires WasmGC. Supported environments include Node.js >=22.12 and modern browsers with WasmGC and module Workers; Bun 1.4.2 and Deno 2.9.6 have also been tested. Missing WasmGC, unavailable Workers, missing Deno file/network permissions, or blocked assets cause an explicit failure. Conversion does not fall back to the browser's main thread or to synchronous execution in server-side runtimes.
Frequently asked questions
Does PPTX-to-PDF conversion upload my presentation?
@s8fy/pptx-converter converts supplied bytes inside your browser or Node.js/Bun/Deno runtime. It does not upload presentations or contact an online license service. Browser Worker/WASM loading and an HTTP wasmUrl still make asset requests.
Can I convert PPTX offline without PowerPoint or LibreOffice?
Yes, once the SDK's runtime assets, input bytes, and required fonts are available locally. The bundled engine needs WebAssembly GC and working Workers. Fonts are supplied explicitly; the SDK does not scan system fonts or download missing fonts automatically. Legacy binary .ppt is outside the documented input contract.
Does PDF output preserve text and vector graphics?
Supported text is emitted as PDF text and supported vector artwork as geometry. Some effects use raster masks, and unsupported content can fall back or be omitted. This does not guarantee that every object stays vector or that PDF layout matches PowerPoint pixel for pixel. PDF does not play animations, transitions, audio, or video.
How do I handle Chinese text or missing fonts?
Supply font bytes with the required glyph coverage through fonts; use regular fallback descriptors when appropriate. CSS fonts installed for browser preview are not PDF font bytes. See the font and CJK guide for supported inputs and deployment boundaries.
Does a Viewer license also cover Converter?
No. Converter uses its own product license; Viewer and xdoc CLI licenses cannot unlock it. Unlicensed PDF output carries a demo watermark. Markdown normally has no demo watermark, but commercial use still requires a commercial license and signed output restrictions still apply. See License.
Should I install Converter or Parser for PDF export?
Use @s8fy/pptx-converter for a standalone conversion API across browsers, Node.js, Bun, and Deno. Use Viewer for preview and presentation controls with export. Parser/Core PDF helpers belong to the Viewer pipeline and have different options and authorization interfaces.
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 separate commercial license, including applications that export only Markdown. Technical access to conversion does not grant commercial usage rights.
Converter uses the independent product ID pptx-converter and signed schema xdoc-converter-license/v1. Viewer and xdoc CLI licenses cannot unlock this package. Pass the issued JSON object or its original JSON string:
import { pptxToPdf } from '@s8fy/pptx-converter'
const pdf = await pptxToPdf(input, { license: signedConverterLicense })| License status | PDF | Markdown | | ----------------------------------------------------------- | ---------------------------- | ------------------------------- | | Missing, invalid, expired, or missing the requested feature | Demo watermark on every page | Export without a demo watermark | | Valid and grants the requested feature | No demo watermark | Normal export | | Export prohibited by an explicit signed restriction policy | Rejected | Rejected |
The returned authorization describes the state and reason. A restriction policy that requires a watermark adds one to PDF output. Markdown cannot fulfill that obligation, so export is rejected.
Free conversion accepts at most 5 MiB (5,242,880 bytes, inclusive) of original compressed PPTX input per task. The current API accepts one PPTX per call; selecting slides still counts the entire input file, for both PDF and Markdown. Missing, invalid, expired or feature-ineligible credentials do not lift this limit; larger inputs reject with free_trial_input_size_limit_exceeded. A valid Converter credential for the requested format removes this commercial quota, while signed restrictions still apply. Explicit fonts are excluded from the PPTX quota; PPTX and font bytes together remain subject to the 100 MiB input resource ceiling and all other resource protections, regardless of license state. There is no additional Free page-count limit.
Browser domain restrictions use the current page's origin and hostname. Node.js, Bun, and Deno have no browser origin and need a license suitable for local execution. The API does not accept overrides for the product, clock, origin, or trusted keys. Offline verification cannot provide a trusted server clock or immediate online revocation, and an ordinary JS/WASM client is not a tamper-proof boundary.
PDF rendering support
The bundled engine projects supported uncached SmartArt linear-process and organization-hierarchy layouts with inherited text styles and font-driven fitting. Cached drawings take precedence; unsupported or ambiguous layouts retain their existing fallback.
PDF supports glyph glow and text reflections, shape inner shadows, selected shape 3D profiles, and solid 3D text. Shape-frame reflections currently require zero blur; this is separate from glyph reflections. Unsupported or over-budget effects retain foreground fallbacks. Reflections do not duplicate foreground text in PDF text extraction. Some effect layers use raster masks, so high-fidelity output does not mean every effect is vector-only.
Authored audio posters are preserved as static graphics. PDF output does not play audio, video, animations, or slide transitions. Font availability and the supported Office feature subset still determine layout and appearance.
Runtime and deployment
- High-fidelity PDF rendering. The engine renders slide layouts, styled text, vector shapes, images, tables, and charts directly to PDF. Supported text and vector content remain text and vectors rather than turning each slide into a screenshot. Font availability and feature support determine fidelity; see PDF rendering support.
- Conversion inside the browser. A presentation can go from a file picker to a downloadable PDF or Markdown without leaving the user's device. No conversion backend, upload endpoint, or remote licensing service is required.
- Standalone Node.js, Bun, and Deno support. Run the bundled engine in your application or scripts. No PowerPoint, LibreOffice, Office automation, headless browser, native executable, or external conversion service is needed.
- Self-contained runtime. The current build includes about 3.3 MB of runtime assets, uncompressed (JavaScript + WASM, decimal MB), with zero runtime npm dependencies. Size varies by release; fonts you supply and optional application dependencies are outside this size. There is no separate Office installation or native engine to download.
- Useful Markdown, with assets. Export text, tables, chart information, speaker notes, and image references, with image bytes returned separately. Choose a human-readable or AI-oriented detail mode for document workflows, indexing, and downstream processing.
- Responsive, cancellable conversion. Conversion runs in Workers. Abort a job, set a timeout, or dispose of a converter; the SDK handles Worker cleanup and preserves your input buffers.
- Local license verification. Signed licenses are checked locally. Unlicensed PDF output carries a demo watermark; Markdown has no demo watermark. Commercial use requires a separate commercial license.
The integration needs presentation bytes, optional font bytes, and the SDK's static assets. Once those assets are available locally, conversion can run offline. This makes the SDK a fit for apps that need to keep documents on-device, self-host their conversion assets, or use the same conversion API across a browser UI and Node.js, Bun, or Deno jobs.
Options and lifecycle
Both conversion functions accept these common options:
| Option | Default | Meaning |
| --------------------------- | ---------------- | -------------------------------------------------------------------------------------- |
| license | None | Issued Converter license object or original JSON string |
| slides | All slides | Nonempty list of existing one-based slide numbers, in output order, without duplicates |
| signal | None | Cancel active or queued work using an AbortSignal |
| timeoutMs | 60_000 | Integer from 1 through 60_000; execution deadline, not queue wait time |
| wasmUrl | Package-relative | Relocate the conversion WASM asset using the host-specific URL rules above |
| workerUrl | Package-relative | Relocate the browser module Worker; ignored by Node/Bun/Deno |
| restrictionPolicies | None | Explicit signed restriction-policy envelopes |
| restrictionPolicySnapshot | None | Optional snapshot used to validate the restriction-policy set |
PDF additionally accepts title (default 'PPTX Presentation'), author (default ''), speakerNotes (default false), officeFontFallbacks (default false), and fonts. officeFontFallbacks selects Office-style fallback metrics for missing non-embedded fonts; it does not fetch fonts. Each font needs typeface and byte data, with optional style (default 'regular') and fallback (default false, regular style only).
Set matchFontProfile: true to select faces as the Viewer does and try regular faces marked
fallback before built-in substitutes for all scripts, including Latin. The default keeps
Converter's existing face and Unicode fallback behavior.
fontEvidence: true adds same-pass PDF font facts with original physical page numbers.
The report records matched, substituted, fallback, and missing glyph outcomes without the run
text. Its truncated flag signals that the evidence limit was reached.
Set watermarkEvidence: true to get writerDemoSlides, the one-based physical source pages
where a Writer demo marker emitted PDF drawing operators, in export order. The Converter's
own evaluation watermark is reported by authorization.outputDisposition.
For scoped Markdown, set content: {} to export only the selected page body. Set
content.speakerNotes or content.assets to true to include notes or embedded images on
those pages. Scoped Markdown suppresses resolved link destinations and playable media.
Markdown additionally accepts fileName (default 'presentation.pptx') for the document heading and detail (default 'human').
Set sourceMap: true to return a separate table of up to 4,096 Markdown blocks, with
half-open UTF-16 offsets, original one-based page numbers and candidate drawing IDs. An emitted
block can have several drawing IDs. Verify the page and each drawing against the same rendered
snapshot before opening an object. Blocks without verified drawing identity can link to the page.
truncated signals that only the first blocks have source entries. The Markdown stays unchanged.
import { createConverter } from '@s8fy/pptx-converter'
const converter = createConverter()
const abort = new AbortController()
try {
const result = await converter.toPdf(input, {
license: signedConverterLicense,
slides: [3, 1], // One-based numbers, in output order; duplicates are rejected.
title: 'Quarterly Review',
author: 'Team',
speakerNotes: true,
timeoutMs: 30_000,
signal: abort.signal,
fonts: [{ typeface: 'Noto Sans CJK SC', data: fontBytes, fallback: true }],
})
} finally {
converter.dispose()
}A converter processes jobs sequentially. The convenience functions also use a shared queue. Each job creates a separate Worker/WASM instance, which terminates on completion, failure, cancellation, or timeout. dispose() cancels all jobs belonging to that converter and rejects later calls. Canceling a queued job does not interrupt another job. Input and font bytes are copied; the caller's buffers are never transferred or detached.
The default execution deadline is 60 seconds and can be shortened. PPTX and supplied fonts together are limited to 100 MiB. ZIP expansion and output are each limited to 512 MiB, with additional shared ZIP/XML/media protections. At most 64 fonts may be supplied. The deadline includes Worker initialization and asset loading, but excludes queue wait time and input preparation. Copies are made when the queued job starts; keep input, font bytes, and options unchanged until the call settles if you need deterministic results.
PDF uses the shared rendering engine. Missing presentation fonts can affect layout and glyphs. Supply fonts with TrueType outlines (TTF, or extractable TTC/EOT data; CFF/WOFF/WOFF2 are unsupported) with regular, bold, italic, or boldItalic styles. A regular font marked fallback: true also supplies missing Unicode glyphs, including the math fallback path. The package does not scan system fonts or download fonts automatically. Your application is responsible for font licensing.
Markdown supports detail: 'human' | 'ai' (default: human) and exports document structure, text, tables, image references, chart information, and notes. It does not reproduce slides pixel for pixel. External links and media references are not downloaded. Office-specific layouts, animations, and complex graphics remain subject to the shared engine's support.
SDK validation, Worker infrastructure, and engine failures use ConverterError with a machine-readable code; input preparation or option serialization can also throw native errors. Explicit cancellation rejects with AbortSignal.reason. Common codes include invalid_input, invalid_options, unsupported_font, wasm_unavailable, worker_failed, conversion_timeout, and disposed, along with engine resource and authorization reason codes.
