SlideCanvas Docs
SlideCanvas is a high-performance, browser-native toolkit for viewing and editing PowerPoint (.pptx) files directly in the web browser. It provides an enterprise-grade engine for parsing, rendering, and exporting presentations with pixel-perfect accuracy and seamless S3 integration.
Key Features
Pixel-Perfect Rendering
High-fidelity display of slides using a sophisticated Fabric.js-based canvas.
AI-Powered Editing
Integrated Gemini AI for smart text manipulation (Shorten, Reframe, Lengthen, Grammar, Rewrite).
Enterprise-Grade Parsing
Deep internal processing of XML-based PPTX structures.
Professional Ribbon UI
A high-density, Microsoft Office-style toolbar layout (120px height).
Slash Commands (/)
A fast, context-aware command menu triggered by typing / anywhere.
AI Image Generation
Integrated flow for generating design assets via optional onGenerateImage hook.
Infographic Generation
Advanced workflow to refine selected slide text into visual prompts.
Smart Actions Group
Prominent buttons for Present, Export (PPTX), and Delete.
Installation
Install SlideCanvas via your preferred package manager. We support npm, yarn, and pnpm.
Internal Flow Architecture
SlideCanvas operates on a sophisticated Unidirectional Data Flow architecture designed for reliability and scalability.
Ingestion Layer
Decomposes binary .pptx uploads or remote URLs.
Normalization Engine
Converts complex XML structures into standardized JSON.
Virtual Canvas Sync
Bridges state to a high-performance Fabric.js canvas.
Serialization Pipe
Reconstructs state back into OpenXML for export.
Getting Started
To build a basic editor, import the PptEditor component into your React or Next.js application.
Remote Loading
SlideCanvas makes it easy to load existing presentations directly via a URL. The component handles the fetching and parsing internally:
S3 Integration
Setup a proxy route to bypass CORS restrictions when loading files from S3.
proxyUrl prop in the PptEditor component.Large Files
To bypass server payload limits, implement a custom client-side fetcher using the fetchPresentation prop.
Slash Commands
Type / at any time to trigger context-aware actions.
- Insert Elements:Instantly add Text, Images, or Shapes.
- AI Actions:Trigger text transformations or AI Image Generation.
AI Image Generation
Integrate your own AI image provider via the onGenerateImage prop.
Custom AI Handlers
Bypass internal Gemini logic with your own backend for custom AI workflows.
Infographics
Two-step workflow for creating visual assets from slide content.
7. Enabling AI Text Refinement
SlideCanvas comes battery-included with Gemini AI support for text.
8. Custom AI Text Refinement Hooks
While SlideCanvas includes built-in Gemini support, you can override the logic with your own AI providers (OpenAI, Anthropic, or custom internal LLMs) using the following hooks:
9. Toolbar Refine vs Ask AI
The editor separates "Quick Actions" (Toolbar) from "Conversational AI" (Slash Command). You can provide distinct handlers for each:
- Toolbar (Refine Menu):Uses
onRefineShorten,onRefineReframe,onRefineLengthen. - Slash Command (Ask AI):Uses
onAiShorten,onAiLengthen,onAiRewrite, etc.
This allows you to use lighter/faster models for the toolbar buttons and more capable models for the conversational interface if desired.
7-Second S3 Auto-Save
Generate a Blob and save to S3 after a 7-second debounce.
Programmatic Creation
Build a presentation state manually to generate slides on the fly.
Headless Processing
Extract text content without rendering the UI.
API Reference
<PptEditor /> Properties
| Property | Type | Default | Description |
|---|---|---|---|
| width | number | string | Required | The width of the editor container. |
| height | number | string | Required | The height of the editor container. |
| initialPresentation | Presentation | undefined | Initial presentation data to load. |
| url | string | undefined | URL of a public .pptx file to load on mount. |
| initialSource | 'scratch' | 'uploaded' | 'url' | undefined | Sets the initial UI source state and badge. |
| appName | string | "SlideCanvas" | Brand name shown in the ribbon. |
| appBgColor | string | "#B7472A" | Primary brand color for the UI. |
| geminiApiKey | string | undefined | API key for built-in AI text actions. |
| onGenerateImage | (prompt: string) => Promise<string> | undefined | Custom hook to handle AI image generation. |
| isTwoStepInfographicGeneration | boolean | false | Enables Step 1: Prompt Refinement modal for infographics. |
| onRefineInfographicPrompt | (text: string) => Promise<string> | undefined | Hook to transform text into a visual prompt (Step 1). |
| onGenerateInfographic | (prompt: string) => Promise<string> | undefined | Hook to generate the infographic image (Step 2). |
| proxyUrl | string | undefined | Base path for the proxy API (used for PPTX loading and image previews). |
| showHomeOnEmpty | boolean | false | Shows a "New / Upload" splash if no data provided. |
| onChange | (pres: Presentation) => void | undefined | Fired on any change to the deck. |
| onSourceChange | (src, url?) => void | undefined | Fired when the deck origin changes (useful for routing). |
| onAiRewrite | (text: string) => Promise<string> | undefined | Optional hook to override default Gemini rewrite logic. |
| onAiGrammar | (text: string) => Promise<string> | undefined | Optional hook to override default Gemini grammar logic. |
| onAiShorten | (text: string) => Promise<string> | undefined | Optional hook to override default Gemini shorten logic. |
| onAiLengthen | (text: string) => Promise<string> | undefined | Optional hook to override default Gemini lengthen logic. |
| onAiContinue | (text: string) => Promise<string> | undefined | Optional hook to override default Gemini continue-writing logic. |
| onRefineShorten | (text: string) => Promise<string> | undefined | Override loop for Toolbar "Shorten" button. |
| onRefineReframe | (text: string) => Promise<string> | undefined | Override loop for Toolbar "Reframe" button. |
| onRefineLengthen | (text: string) => Promise<string> | undefined | Override loop for Toolbar "Lengthen" button. |
| fetchPresentation | (url: string) => Promise<ArrayBuffer | Blob> | undefined | Custom fetcher for loading presentations, bypassing the proxy. |
Usage Examples
1. Branded Full-Screen Editor
Perfect for a standalone presentation app.
Advanced Features
Custom Image Generation
SlideCanvas provides a hook to integrate any image generation API.
Headless Utilities
SlideCanvas provides a set of utilities for processing PPTX files on the server or in a web worker.
Production Considerations
For high-traffic applications, we recommend using a CDN for your PPTX assets and configuring SlideCanvas to fetch them directly using the fetchPresentation hook.
License
SlideCanvas is licensed under the Apache License, Version 2.0.