chenchunrun/onyx-soc/pdf-report
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
生成专业的 PDF 报告文档,支持封面页、多级标题、表格、图片、页眉页脚等功能。当用户需要将分析结果、报告内容输出为 PDF 格式时使用此技能。
Install
npx vskill@latest install chenchunrun/onyx-soc/pdf-reportSKILL.md
PDF Report - PDF 报告生成
Overview
基于 reportlab 库的 PDF 报告生成工具,提供专业的文档排版功能,支持中文字体、封面页、多级标题、表格、图片等元素。适用于生成安全分析报告、威胁情报报告、业务分析报告等场景。
核心功能
| 功能 | 说明 | |
|---|---|---|
| 封面页 | 带背景图、标题、副标题、作者、日期信息 | |
| 多级标题 | 支持 1-4 级标题,自动样式 | |
| 正文段落 | 首行缩进、1.5 倍行距、两端对齐 | |
| 表格 | 自动换行、交替行背景色、表头高亮 | |
| 图片 | 自动缩放、居中、带说明文字 | |
| 页眉页脚 | 页眉文本、页码(从正文开始计数) | |
| 中文支持 | 自动加载中文字体 |
工作流程
阶段 1: 初始化
语言支持:
| 参数 | 效果 | |
|---|---|---|
language='zh' | 中文(默认):作者、表、图、第 N 页 | |
language='en' | 英文:Author、Table、Figure、Page N |
说明: 初始化时会自动下载中文字体和默认封面背景图(如果不存在)。
阶段 2: 配置文档
阶段 3: 添加封面页
阶段 4: 添加正文内容
标题
正文段落
表格
表格自动编号: 表格说明会自动编号为 "表<1>", "表<2>" 等。
图片
图片自动编号: 图片说明会自动编号为 "图<1>", "图<2>" 等。
其他元素
阶段 5: 保存文档
完整示例
依赖要求
必需依赖
| 依赖 | 用途 | 安装命令 | |
|---|---|---|---|
| reportlab | PDF 生成核心库 | pip install reportlab | |
| Pillow | 图片处理 | pip install Pillow | |
| PyPDF2 | PDF 合并(用于添加最后一页) | pip install PyPDF2 |
安装命令
环境检查
API 参考
PDFTemplate 类
| 方法 | 参数 | 说明 | |
|---|---|---|---|
add_cover_page() | title, subtitle, author, date, organization, additional_info | 添加封面页 | |
add_title() | text, level (1-4) | 添加标题 | |
add_content() | text, first_line_indent (bool) | 添加正文段落 | |
add_table() | rows, cols, data, caption | 添加表格 | |
add_image() | image_path, width, height, caption | 添加图片 | |
add_page_break() | 无 | 添加分页符 | |
add_spacer() | height (默认 12) | 添加空白间距 | |
set_cover_background() | background_image_path | 设置封面背景图 | |
save_document() | filename | 保存 PDF 文档 | |
get_document_info() | 无 | 获取文档统计信息 |
属性
| 属性 | 类型 | 说明 | |
|---|---|---|---|
header_text | str | 页眉文本 | |
story | list | 文档内容元素列表 |
注意事项
- 中文字体: 优先使用嵌入式 TTF 字体(SourceHanSansCN),确保在微信等第三方预览器中也能正确显示中文。首次运行会自动下载字体文件,需要网络连接。若下载失败则降级为 CID 字体(依赖阅读器本地字体)
- 封面背景: 默认使用在线背景图,可通过
set_cover_background()设置本地图片 - 图片格式: 支持 PNG、JPEG、GIF 等常见格式
- 表格宽度: 表格会自动适应页面宽度,列宽按比例分配
- 页码: 页码从正文页开始计数,封面页不显示页码
相关参考
- references/report-format.md - 报告格式规范
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/pdf-report/SKILL.md
Popularity
- 7-day trend score
- 0
Refreshed 27 Apr 2026, 5 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/chenchunrun/onyx-soc/pdf-report)