返回顶部
p

pdf-report

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.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
144
下载量
0
收藏
概述
安装方式
版本历史

pdf-report

# PDF Report Generate a clean A4 PDF from structured JSON data. ## Setup Install system dependencies (WeasyPrint requires these): ```bash # 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): ```bash python3 -m venv ~/.openclaw/workspace/.venv_pdf ~/.openclaw/workspace/.venv_pdf/bin/pip install weasyprint jinja2 ``` ## Quick start ```bash ~/.openclaw/workspace/.venv_pdf/bin/python skills/pdf-report/scripts/render_pdf.py \ --input exports/report-data.json \ --output exports/pdfs/report.pdf ``` ## Inputs - `--input` path to a JSON file inside the workspace - `--output` path to the PDF output inside the workspace - Optional: `--template-file` custom Jinja2 template path inside the workspace - Optional: `--html-out` write the rendered HTML for debugging ## Expected JSON shape ```json { "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" } ``` ## Notes - All file paths (CLI arguments and `charts[].src` in JSON) must stay inside the workspace. Paths outside the workspace are rejected. - Missing chart images produce a warning to stderr but do not block PDF generation. - Use `chart-mpl` first when a section needs chart images, then reference those image paths in `charts[].src`. - Output directories are created automatically. - Default template: `skills/pdf-report/templates/report.html` - Dedicated venv: `~/.openclaw/workspace/.venv_pdf/` (weasyprint + jinja2) - Pages are numbered automatically (bottom-right: "1 / 3"). ## Custom templates 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.

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 pdf-report-1776071776 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 pdf-report-1776071776 技能

通过命令行安装

skillhub install pdf-report-1776071776

下载 Zip 包

⬇ 下载 pdf-report v1.0.1

文件大小: 5.93 KB | 发布时间: 2026-4-14 14:11

v1.0.1 最新 2026-4-14 14:11
v1.0.1 — Security hardening + publish readiness

- Chart image paths from JSON are now validated against the workspace boundary (paths outside are rejected)
- Missing chart images produce a warning instead of silent broken images
- Workspace root detection is now resilient (OPENCLAW_WORKSPACE env var > marker file walk > fallback)
- Added Setup section with system deps, venv creation, and pip install
- Added automatic page numbering (bottom-right: "1 / 3")
- Documented custom template base_url behavior

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部