@wity/scene-to-pptx
Server-side presentation renderer. Snapshots a wity-scene document at one or more timestamps and produces a PowerPoint (.pptx) file using node-canvas and pptxgenjs. Node.js / Lambda only, not browser-compatible.
The output is directly importable into PowerPoint, Keynote, and Google Slides.
Entry point: Call
witySceneRenderwithoutputFormat: "pptx"— do not invoke this Lambda directly. See the Deployment guide.
Install
npm install @wity/scene-to-pptx
# peer deps:
npm install @wity/scene-core @xmldom/xmldomrender(sceneXml, fontManifest, options)
Render scene snapshots to a PowerPoint file on disk.
render(
sceneXml: string,
fontManifest: Record<string, string>,
options: {
ts?: number,
timestamps?: number[],
}
): Promise<{ pptxPath: string, cleanup: () => Promise<void> }>| Argument | Type | Description |
|---|---|---|
sceneXml | string | Raw <wity-scene> XML |
fontManifest | Record<string, string> | Font family name → URL. Pass {} if no custom fonts. |
options.ts | number (default 0) | Scene time in seconds to snapshot. Ignored when timestamps is provided. |
options.timestamps | number[] | Array of scene times — each produces one slide. |
Returns:
| Field | Description |
|---|---|
pptxPath | Absolute path of the rendered .pptx in /tmp |
cleanup | Call after upload to remove temp files |
import { render } from '@wity/scene-to-pptx';
// Single slide at t=0
const { pptxPath, cleanup } = await render(sceneXml, {}, { ts: 0 });
// upload pptxPath to storage...
await cleanup();// Multi-slide deck: one slide per timestamp
const { pptxPath, cleanup } = await render(sceneXml, fontManifest, {
timestamps: [0, 5.0, 10.0, 15.0],
});Slide layout
The presentation layout is set to the scene's pixel dimensions interpreted at 96 DPI (standard screen PPI), preserving the exact aspect ratio:
- 1920 × 1080 scene → 20" × 11.25" slides (widescreen 16:9)
- 1080 × 1920 scene → 11.25" × 20" slides (portrait / reels)
Each slide contains the rendered scene frame as a full-bleed pixel-perfect PNG image.
What is rendered
| Element type | Rendered? |
|---|---|
ws-rect | Yes — filled rectangles, stroke, border-radius |
ws-text | Yes — font, color, animation state at ts |
ws-image | Yes — image with fit modes |
ws-video | No — skipped silently (graphics snapshot only) |
ws-audio | No — skipped silently |
Animation and keyframe state is fully resolved at each ts — evaluate(scene, ts) produces the exact visual frame per slide.
Lambda deployment
The witySceneToPptx Lambda wraps this package.
Input:
{
"sceneXml": "<wity-scene>...</wity-scene>",
"fontManifest": {},
"timestamps": [0, 5.0, 10.0]
}Response:
{ "url": "https://...", "fileSize": 456789, "slides": 3 }| Config | Value |
|---|---|
| Function name | witySceneToPptx |
| Memory | 1024 MB |
| Timeout | 120 s |
| Ephemeral storage | 1024 MB |
| Runtime | Node.js 20 |
| FFmpeg layer | Not required |
