Skip to main content

Document Export

The Document Export extension generates professional PDF, DOCX, PPTX, CSV, and XLSX documents from structured content. It ships as @framers/agentos-ext-document-export and provides two tools -- document_export for generation and document_suggest for format recommendation.

No API keys required. The extension is built-in and available to all agents.

Quick Start

In wunderland chat, the agent can export any substantive response:

You: Research the history of the internet and give me a report.
Agent: [produces research]... I can export this as PDF, DOCX, or PPTX. Want me to?
You: PDF please.
Agent: Done! Download your report: http://localhost:3777/exports/2026-03-28T12-00-00-history-of-the-internet.pdf

Supported Formats

FormatExtensionBest ForKey Features
PDF.pdfReports, research, formal documentsCover page, headers/footers, page numbers, styled tables, inline markdown, images, charts
DOCX.docxEditable documents for Word/Google DocsSame content as PDF, fully editable, themed table headers, numbered/bulleted lists
PPTX.pptxPresentations, pitch decks, summaries5 themes, 7 slide layouts, native charts, speaker notes, slide numbers, embedded images
CSV.csvData export, spreadsheet importRFC 4180 compliant, multiple table blocks separated by blank rows
XLSX.xlsxFormatted spreadsheetsMulti-sheet, styled headers, auto-SUM formulas, numeric detection, frozen header rows

Tools

document_export

Generate a document from structured content.

Input:

{
"format": "pdf",
"content": {
"title": "Q4 Revenue Analysis",
"subtitle": "Fiscal Year 2026",
"author": "Research Team",
"date": "2026-03-28",
"theme": "corporate",
"sections": [
{
"heading": "Executive Summary",
"level": 1,
"paragraphs": [
"Revenue grew **23%** year-over-year, driven by enterprise expansion.",
"See the [full methodology](https://example.com/methods) for details."
]
},
{
"heading": "Revenue by Region",
"level": 2,
"table": {
"headers": ["Region", "Q3", "Q4", "Growth"],
"rows": [
["North America", "4.2M", "5.1M", "+21%"],
["Europe", "2.8M", "3.5M", "+25%"],
["Asia Pacific", "1.5M", "2.0M", "+33%"]
]
},
"chart": {
"type": "bar",
"title": "Q4 Revenue by Region",
"data": [
{
"label": "Q3",
"values": [4.2, 2.8, 1.5],
"categories": ["NA", "EU", "APAC"]
},
{
"label": "Q4",
"values": [5.1, 3.5, 2.0],
"categories": ["NA", "EU", "APAC"]
}
]
}
},
{
"heading": "Key Metrics",
"level": 2,
"keyValues": [
{ "key": "Total Revenue", "value": "$10.6M" },
{ "key": "YoY Growth", "value": "23%" },
{ "key": "New Customers", "value": "847" }
]
}
]
},
"options": {
"pageSize": "a4",
"orientation": "portrait",
"coverPage": true,
"pageNumbers": true
}
}

Output:

{
"filePath": "/workspace/exports/2026-03-28T12-00-00-q4-revenue-analysis.pdf",
"downloadUrl": "http://localhost:3777/exports/2026-03-28T12-00-00-q4-revenue-analysis.pdf",
"previewUrl": "http://localhost:3777/exports/2026-03-28T12-00-00-q4-revenue-analysis.pdf/preview",
"format": "pdf",
"sizeBytes": 48256,
"filename": "2026-03-28T12-00-00-q4-revenue-analysis.pdf"
}

document_suggest

Analyse a response to determine if export should be offered. No LLM call -- pure heuristic.

{
"responseText": "Full analysis text...",
"wordCount": 850,
"hasTableData": true,
"hasSections": true,
"isAnalytical": false
}

Rules:

  • 500+ words -> PDF, DOCX
  • Tabular data -> CSV, XLSX
  • Distinct sections -> PPTX
  • Analytical/quantitative -> PDF, XLSX
  • Minimum 200 words before any suggestion

Content Sections

Each section in content.sections[] can contain any combination of:

FieldTypeDescription
headingstringSection heading text
level1 | 2 | 3Heading depth (H1/H2/H3)
paragraphsstring[]Body text with inline markdown (**bold**, *italic*, [link](url))
table{ headers, rows }Tabular data rendered as a formatted table
chart{ type, data, title? }Embedded chart (bar, line, pie, doughnut, area, scatter)
list{ items, ordered? }Bulleted or numbered list
keyValues[{ key, value }]Definition table (rendered as two-column table)
image{ url?, base64?, caption?, width? }Embedded image from URL or data URI
speakerNotesstringPPTX only -- notes attached to the slide
layoutstringPPTX only -- slide layout hint

Slide Themes

Five built-in themes control colours, fonts, and chart palettes across all generators:

ThemeBackgroundAccentUse Case
darkDeep navy (#1a1a2e)Cyan (#00d4ff)Conference talks, tech demos
lightWhite (#ffffff)Blue (#2563eb)General purpose, academic (default)
corporateLight grey (#f8f9fa)Bootstrap blue (#0d6efd)Business reports, quarterly reviews
creativeWarm amber (#fef3c7)Gold (#f59e0b)Marketing, workshops, pitches
minimalWhite (#ffffff)Grey (#6b7280)Data-focused, research, monochrome

Set the theme in the content object:

{
"content": {
"title": "Product Launch",
"theme": "creative",
"sections": [...]
}
}

Chart Rendering

Charts are rendered natively in PPTX (via pptxgenjs). In PDF and DOCX, charts are rendered as styled data tables with ASCII bar visualisations for bar/line/area types and percentage columns for pie/doughnut types.

Supported chart types:

TypeDescriptionColumns in PDF/DOCX
barVertical bar comparisonCategory, Dataset values, ASCII bar
lineTrend over categoriesCategory, Dataset values, ASCII bar
areaFilled line chartCategory, Dataset values, ASCII bar
pieProportional slicesLabel, Value, Percentage
doughnutPie with centre holeLabel, Value, Percentage
scatterX/Y data pointsDataset, X, Y

Chart data structure:

{
"chart": {
"type": "pie",
"title": "Market Share",
"data": [
{
"label": "2026",
"values": [45, 30, 15, 10],
"categories": ["Product A", "Product B", "Product C", "Other"]
}
]
}
}

Slide Layouts

For PPTX generation, each section can specify a layout hint:

LayoutDescription
titleLarge centred title slide (use for openers)
contentStandard title + body (default)
two-columnSide-by-side content columns
image-leftImage on left, text on right
image-rightImage on right, text on left
chart-fullFull-bleed chart slide
comparisonTwo-panel comparison layout

Export Options

OptionTypeDefaultDescription
filenamestringSlugified titleCustom output filename (without extension)
pageSizeletter | a4 | legalletterPage size for PDF/DOCX
orientationportrait | landscapeportraitPage orientation
coverPagebooleantrueWhether to generate a cover/title page
pageNumbersbooleantrueWhether to show page numbers in footer

Integration with Missions

Document export fits naturally at the end of research and analysis pipelines. Use the document_export tool in the final phase of a mission to produce deliverables.

name: quarterly-analysis
goal: "Analyse Q4 data and produce an executive report"
planner:
strategy: parallel-then-linear
phases:
- name: research
parallel: true
steps:
- tool: web_search
input: { query: "industry trends Q4 2026" }
- tool: deep_research
input: { query: "competitor analysis Q4", depth: moderate }
- name: synthesize
steps:
- tool: self_evaluate
input: { criteria: [accuracy, completeness] }
- name: export
steps:
- tool: document_export
input:
format: pdf
content: "{{synthesized_report}}"
options: { coverPage: true, pageNumbers: true }
- tool: document_export
input:
format: pptx
content: "{{executive_slides}}"
options: { coverPage: true }

CLI Usage

In wunderland chat, the agent automatically has access to both tools. Ask for exports naturally:

You: Summarize the latest AI research papers and export as a PDF.
You: Turn that analysis into a slide deck with the corporate theme.
You: Export the data as an Excel spreadsheet.
You: Can you make a Word doc version of that report?

The agent uses document_suggest internally to proactively offer exports after long, structured, or data-heavy responses.

File Management

Exported files are saved to {workspaceDir}/exports/ with timestamped filenames:

exports/
2026-03-28T12-00-00-q4-revenue-analysis.pdf
2026-03-28T12-05-30-market-overview.pptx
2026-03-28T12-10-15-sales-data.xlsx

The ExportFileManager handles:

  • Automatic directory creation
  • Timestamped, slugified filenames to avoid collisions
  • Download URL generation (/exports/{filename})
  • Preview URL generation (/exports/{filename}/preview)
  • File listing, resolution, and deletion

Previews are format-specific: CSV and XLSX render as HTML tables (first 10 rows); PDF, DOCX, and PPTX show a plain-text size summary.