name: pdf-report version: 1.0.1 description: Generate clean A4 PDF reports from structured JSON using Jinja2 and WeasyPrint. Use when the user needs a formatted PDF document — analytical summary, data report, or chart-based export — from workspace data. metadata: { "openclaw": { "emoji": "PDF", "requires": { "bins": ["python3"] } } }
Generate a clean A4 PDF from structured JSON data.
Install system dependencies (WeasyPrint requires these):
# Ubuntu/Debian
sudo apt-get install -y libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev libcairo2
Create a virtual environment and install Python dependencies (one-time):
python3 -m venv ~/.openclaw/workspace/.venv_pdf
~/.openclaw/workspace/.venv_pdf/bin/pip install weasyprint jinja2
~/.openclaw/workspace/.venv_pdf/bin/python skills/pdf-report/scripts/render_pdf.py \
--input exports/report-data.json \
--output exports/pdfs/report.pdf
--input path to a JSON file inside the workspace--output path to the PDF output inside the workspace--template-file custom Jinja2 template path inside the workspace--html-out write the rendered HTML for debugging{ "title": "Monthly Report", "subtitle": "Summary by region", "generated_at": "2026-03-23 10:00", "summary": ["Key point 1", "Key point 2"], "sections": [ { "title": "Sales by category", "lead": "National overview", "items": ["Observation 1", "Observation 2"], "table": { "headers": ["Category", "Amount", "Share"], "rows": [["Electronics", "12 450", "45%"]] }, "charts": [ { "title": "Distribution by category", "src": "exports/charts/category.png", "caption": "Source: sales database" } ], "note": "Data as of 31/12/2025" } ], "footer": "Company Name — Department" }7w4.net小葱技能站收录全网优质技能,值得收藏。
charts[].src in JSON) must stay inside the workspace. Paths outside the workspace are rejected.chart-mpl first when a section needs chart images, then reference those image paths in charts[].src.skills/pdf-report/templates/report.html~/.openclaw/workspace/.venv_pdf/ (weasyprint + jinja2)Use --template-file to provide your own Jinja2 HTML template. Note that relative asset paths inside custom templates (images, CSS) resolve from the workspace root, not the template's directory. Use workspace-root-relative paths for any referenced assets.
这是一个相当实用的 PDF 报告生成工具,能把结构化数据快速转换为格式美观的文档。它对输入数据的容错处理较好,支持表格、图表、摘要等多种内容类型。模板设计专业,输出效果整洁。不足之处是默认模板只支持法语界面,对于中文或其他语言用户需要额外配置。此外安装时需要配置多个系统依赖项,稍有门槛。总体而言功能成熟度和完成度较高,适合需要定期生成数据报告的用户。.