doc2slides
v2.7.2Convert PDF, Word, and Markdown documents into professional PowerPoint slides with 18+ layout types and smart layout matching. Use when: user wants to create slides from a document or convert content to PPT.
Installation
Doc2Slides
Convert documents into professional PowerPoint slides with smart layout matching.
What It Does
- 18+ Layouts: Dashboard, Timeline, Flow Chart, Pyramid, Comparison, Matrix, etc.
- Smart Matching: Picks the best layout per section (template-based, works offline)
- Optional LLM Boost: Enable AI-powered layout analysis via environment variables
- High Quality: 3x resolution with charts and data visualizations
- Batch Mode: Handles long documents (10+ pages) via split generation
Environment Variables (All Optional)
Template-based layout works without any remote service. These enable LLM-enhanced analysis:
| Variable | Purpose |
|---|---|
LLM_MODEL |
Override default model selection |
OPENAI_API_KEY |
OpenAI provider |
OPENAI_BASE_URL |
Custom OpenAI-compatible endpoint |
ZHIPU_API_KEY |
Zhipu GLM provider |
DEEPSEEK_API_KEY |
DeepSeek provider |
OLLAMA_BASE_URL |
Local Ollama endpoint (default: localhost:11434) |
Provider credentials can also come from ~/.openclaw/agents/main/agent/models.json (OpenClaw's model configuration).
Install
# Core dependencies (required)
pip3 install python-pptx playwright
playwright install chromium
# Optional — for LLM-enhanced layout intelligence
pip3 install openai requests
Quick Start
cd ~/.openclaw/workspace/skills/doc2slides/scripts
python3 workflow.py --input /path/to/document.pdf --output slides.pptx
Pre-Flight Checklist (MANDATORY)
Before running any command, the agent MUST ask the user for preferences. Do NOT start generation immediately after receiving a file.
Ask the user: "有什么特殊要求吗?比如风格、页数、重点内容、配色偏好等。直接说需求就行,也可以说'按默认来'。"
The user can provide any free-form instruction — it is passed to both the content analysis LLM and the HTML generation LLM as highest-priority override.
Examples of valid instructions: - "商务风格,重点突出财务数据,控制在10页以内" - "学术风格,每页要有数据引用,15页左右" - "科技感,暗色背景,每页必须有图表" - "简约风,只保留核心结论,不要太多文字"
The instruction is applied via --instruction and takes precedence over all default rules in both analysis and rendering stages.
If the user says "按默认来" / "直接生成" / "没有要求", proceed with defaults (no --instruction flag).
How It Works
- Read — Load document content (PDF, DOCX, Markdown)
- Analyze — Identify structure and key points
- Match — Select layout for each section (template fallback or LLM-assisted)
- Build — Create styled slide images
- Export — Assemble into PPTX file
Tips
- Documents with clear headings and bullet points work best
- Shorter documents (1-20 pages) produce optimal results
- All source code is included in the skill bundle for review
License
MIT-0