| Route | Trigger | Route File |
|---|---|---|
| ------- | --------- | ------------ |
| HTML (default) | All PDF creation requests | handlers/html.md |
| LaTeX | User explicitly requests LaTeX, .tex, or Tectonic | handlers/latex.md |
| Process | Work with existing PDFs (extract, merge, fill forms, etc.) | handlers/process.md |
Default to HTML. Only use LaTeX route when user explicitly requests it.
⛔ HTML→PDF 转换必须使用本 skill 的脚本,严禁使用 convert_file 工具!
当你写好 HTML 后,必须使用以下命令转换为 PDF:
bash .minimax/skills/minimax-pdf/scripts/pdf.sh html document.html --preserve-links
禁止行为:
convert_file / mcp__matrix__convert_file 工具将 HTML 转为 PDF原因: convert_file 工具使用截图拼接方式生成 PDF,会导致:
本 skill 的 pdf.sh html 使用 Paged.js + Playwright 原生 PDF 引擎,输出矢量文本、智能分页、CSS @page 支持。
⛔ Playwright/Chromium 报错时,必须修复依赖后重试,严禁降级到 convert_file!
如果运行 pdf.sh html 或 html_to_pdf.js 时遇到以下错误:
Playwright module not foundChromium browser not foundbrowserType.launch: Executable doesn't exist正确做法(按顺序执行):
npm install -g playwrightnpx playwright install chromiumpdf.sh html 或 node html_to_pdf.js)如果 bash 在 Windows 上不可用(WSL 报错),直接用 node 调用:
node .minimax/skills/minimax-pdf/scripts/html_to_pdf.js document.html --output output.pdf --preserve-links
绝对禁止的行为:
convert_file / mcp__matrix__convert_file为什么不能降级? convert_file 是截图拼接,产出的 PDF 质量极差(模糊、不可选中文字、分页错乱)。
修复依赖只需 1-2 分钟,但降级产出的 PDF 无法使用。
You MUST read the corresponding route file before writing ANY code.
Route files contain critical implementation details NOT duplicated here.
Skipping this step leads to incorrect output (wrong scripts, missing CSS, broken layouts).
Before implementation, you MUST:
handlers/html.md, handlers/latex.md, or handlers/process.md)This file (SKILL.md) contains constraints and principles. Route files contain how-to details.
| User Says | Route |
|---|---|
| ----------- | ------- |
| "Create a PDF", "Make a report", "Write a paper" | HTML |
| "Use LaTeX", "Compile .tex", "Use Tectonic" | LaTeX |
| "Extract text from PDF", "Merge these PDFs", "Fill this form" | Process |
⛔ 每次生成 PDF 前,都必须先判断是否需要封面!不要默认加封面!
按以下流程判断:
Step 1: 用户是否提供了已有内容?(翻译、转换、邮件转 PDF、文档转 PDF 等)
Step 2: 用户是否明确表达了封面意愿?
Step 3: 根据内容类型推断
| 内容类型 | 封面决策 |
|---|---|
| --------- | --------- |
| 简短内容、邮件正文、备忘录 | ❌ 不加 |
| 从零创作的正式报告、研究报告、论文 | ✅ 推荐加 |
| 不确定 | 询问用户 |
如果决定加封面,选择风格:
| Context | Style |
|---|---|
| --------- | ------- |
| Academic paper, thesis, formal coursework | Minimal |
| Business reports, professional documents | Corporate |
| Technical reports, IT/tech documentation | Tech |
| Marketing, creative, design documents | Creative |
⛔ 如果要加封面,必须使用 html.md 中的完整模板代码!
禁止行为:
.cover-bg, .cover-gradient, .cover-header, .cover-category 等类名)linear-gradient / radial-gradient 背景正确做法:
⭐ TEMPLATE 部分自检: 如果你的 HTML 中有封面,class 必须是以下之一(否则你写错了):
cover-minimalcover-corporatecover-techcover-creative如果你发现自己写的 class 不在上面的列表中(例如 .cover-header、.cover-category、.cover-meta),立即停止并使用模板重写。
⛔ 转换/翻译已有内容时,必须执行以下检查!
超链接保留:
外部链接,翻译后必须保留 href 属性翻译后的文字,不要丢掉链接只保留文字--preserve-links,否则 PDF 中链接不可点击图片数量确认(三步核对):
![]()
数量与提取的图片数量一致,每张都引用到了Figures/Tables: X figures 数字,确认与预期一致如果任何一步数量不对,停下来检查,不要直接交付。
| Document Language | Format |
|---|---|
| ------------------- | -------- |
| Chinese | GB/T 7714 (use [J][M][D] identifiers) |
| English | APA |
| Mixed | Chinese refs → GB/T 7714, English refs → APA |
Use the unified CLI for all operations (严禁使用 convert_file 工具替代):
# Check environment (JSON output, exit code 0=ok, 2=missing deps)
bash .minimax/skills/minimax-pdf/scripts/pdf.sh check
# Auto-fix missing dependencies (idempotent, safe to run multiple times)
bash .minimax/skills/minimax-pdf/scripts/pdf.sh fix
# Convert HTML to PDF (⚠️ 必须用这个命令,不要用 convert_file 工具!)
bash .minimax/skills/minimax-pdf/scripts/pdf.sh html input.html --preserve-links
# Compile LaTeX to PDF
bash .minimax/skills/minimax-pdf/scripts/pdf.sh latex input.tex
# Alternative: Direct node call for HTML conversion
node .minimax/skills/minimax-pdf/scripts/html_to_pdf.js input.html --output output.pdf --preserve-links
> Note: Use bash script.sh instead of ./script.sh to avoid permission issues.
> ⚠️ CRITICAL: HTML→PDF conversion MUST use the commands above. Do NOT use convert_file / mcp__matrix__convert_file tool — it produces low-quality screenshot-based PDFs with broken pagination.
Exit codes:
0 = success1 = usage error2 = dependency missing (run pdf.sh fix)3 = runtime errorDependencies by route:
Output language must match user's query language.
DO NOT fabricate information. When in doubt, SEARCH.
If content involves ANY of these, you MUST search FIRST before writing:
Never proceed with writing if you need statistics, research data, or policy information without searching first.
Making up facts is strictly prohibited. When uncertain, search.
| Scenario | Search? | Notes |
|---|---|---|
| ---------- | --------- | ------- |
| Statistics, data | Required | e.g., "2024 employment rate" |
| Policies, regulations | Required | e.g., "startup subsidies" |
| Research, papers | Required | e.g., "effectiveness of method X" |
| Time-sensitive content | Required | Information after knowledge cutoff |
| Uncertain facts | Required | If unsure, always search |
| Common knowledge | Not needed | e.g., "water boils at 100°C" |
Search workflow:
Fabricating references is prohibited. All citations must have:
As shown in <a href="#fig-1-1">Figure 1-1</a>...
From <a href="#eq-2-1">Equation (2-1)</a>...
See <a href="#sec3">Section 3</a>...
Note: id must be placed at container top (see CSS Counters section in html.md).
Must strictly follow user-specified word or page count requirements:
| User Request | Execution Standard |
|---|---|
| -------------- | ------------------- |
| Specific word count (e.g., "3000 words") | Within ±20%, i.e., 2400-3600 words |
| Specific page count (e.g., "5 pages") | Exactly equal, last page may be partial |
| Word count range (e.g., "2000-3000 words") | Must fall within range |
| No explicit requirement | Infer reasonably by document type; prefer thorough over superficial |
| Minimum specified (e.g., "more than 5000 words") | No more than 2x, i.e., 5000-10000 words |
Prohibited behaviors:
Special case - Resume/CV:
margin: 1.5cmWhen user provides outline:
When no user outline:
| Route | Tools | Purpose |
|---|---|---|
| ------- | ------- | --------- |
| HTML | Playwright + Paged.js | HTML → PDF conversion |
| HTML | KaTeX, Mermaid | Math formulas, diagrams |
| Process | pikepdf | Form filling, page operations, metadata |
| Process | pdfplumber | Text and table extraction |
| Process | LibreOffice | Office → PDF conversion |
| LaTeX | Tectonic | LaTeX → PDF compilation |
共 1 个版本