kimi-pdf

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Route Selection

路径选择

RouteTriggerRoute File
HTML (default)All PDF creation requests
routes/html.md
LaTeXUser explicitly requests LaTeX, .tex, or Tectonic
routes/latex.md
ProcessWork with existing PDFs (extract, merge, fill forms, etc.)
routes/process.md
Default to HTML. Only use LaTeX route when user explicitly requests it.
路径触发条件路径文件
HTML(默认)所有PDF创建请求
routes/html.md
LaTeX用户明确要求LaTeX、.tex或Tectonic
routes/latex.md
Process(处理)处理现有PDF(提取内容、合并、填写表单等)
routes/process.md
默认使用HTML路径。仅当用户明确要求时才使用LaTeX路径。

MANDATORY: Read Route File Before Implementation

强制要求:实施前请阅读路径文件

<system-reminder> 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). </system-reminder>
Before implementation, you MUST:
  1. Determine the route (HTML / LaTeX / Process)
  2. Read the route file (
    routes/html.md
    ,
    routes/latex.md
    , or
    routes/process.md
    )
  3. Only then proceed with implementation
This file (SKILL.md) contains constraints and principles. Route files contain how-to details.
<system-reminder> 在编写任何代码之前,您必须阅读对应的路径文件。 路径文件包含此处未重复的关键实施细节。 跳过此步骤会导致输出错误(脚本错误、缺少CSS、布局损坏)。 </system-reminder>
实施前,您必须:
  1. 确定路径(HTML / LaTeX / Process)
  2. 阅读路径文件
    routes/html.md
    routes/latex.md
    routes/process.md
  3. 之后再开始实施
本文件(SKILL.md)包含约束条件和原则。路径文件包含具体实现步骤

Decision Rules

决策规则

Route Selection

路径选择

User SaysRoute
"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"、"生成报告"、"撰写论文"HTML
"使用LaTeX"、"编译.tex文件"、"使用Tectonic"LaTeX
"从PDF提取文本"、"合并这些PDF"、"填写此表单"Process

Cover Style Selection (HTML Route)

封面样式选择(HTML路径)

ContextStyle
Academic paper, thesis, formal courseworkMinimal (white, centered, no decoration)
Reports, proposals, professional documentsDesigned (choose from style reference in html.md)
UncertainDefault to Designed — plain text cover = mediocre
Key principle: Cover background separates "acceptable" from "impressive". See html.md for 11 style options.
场景样式
学术论文、毕业论文、正式课程作业极简风格(白色背景、居中、无装饰)
报告、提案、专业文档设计风格(从html.md的样式参考中选择)
不确定默认使用设计风格——纯文本封面效果一般
核心原则:封面背景是区分"合格"与"出色"的关键。查看html.md了解11种样式选项。

Citation Format Selection

引用格式选择

Document LanguageFormat
ChineseGB/T 7714 (use [J][M][D] identifiers)
EnglishAPA
MixedChinese refs → GB/T 7714, English refs → APA

文档语言格式
中文GB/T 7714(使用[J][M][D]标识符)
英文APA
混合语言中文参考文献→GB/T 7714,英文参考文献→APA

Quick Start

快速开始

Use the unified CLI for all operations:
bash
undefined
所有操作使用统一CLI:
bash
undefined

Check environment (JSON output, exit code 0=ok, 2=missing deps)

检查环境(JSON格式输出,退出码0=正常,2=缺少依赖)

/app/.kimi/skills/kimi-pdf/scripts/pdf.sh check
/app/.kimi/skills/kimi-pdf/scripts/pdf.sh check

Auto-fix missing dependencies (idempotent, safe to run multiple times)

自动修复缺失的依赖(幂等操作,可多次安全运行)

/app/.kimi/skills/kimi-pdf/scripts/pdf.sh fix
/app/.kimi/skills/kimi-pdf/scripts/pdf.sh fix

Convert HTML to PDF

将HTML转换为PDF

/app/.kimi/skills/kimi-pdf/scripts/pdf.sh html input.html
/app/.kimi/skills/kimi-pdf/scripts/pdf.sh html input.html

Compile LaTeX to PDF

编译LaTeX为PDF

/app/.kimi/skills/kimi-pdf/scripts/pdf.sh latex input.tex

**Exit codes:**
- `0` = success
- `1` = usage error
- `2` = dependency missing (run `pdf.sh fix`)
- `3` = runtime error

**Dependencies by route:**
- **HTML route**: Node.js, Playwright, Chromium
- **Process route**: Python 3, pikepdf, pdfplumber
- **LaTeX route**: Tectonic

---
/app/.kimi/skills/kimi-pdf/scripts/pdf.sh latex input.tex

**退出码说明:**
- `0` = 成功
- `1` = 使用错误
- `2` = 缺少依赖(运行`pdf.sh fix`修复)
- `3` = 运行时错误

**各路径依赖:**
- **HTML路径**:Node.js、Playwright、Chromium
- **Process路径**:Python 3、pikepdf、pdfplumber
- **LaTeX路径**:Tectonic

---

Core Constraints (Must Follow)

核心约束(必须遵守)

1. Output Language

1. 输出语言

Output language must match user's query language.
  • User writes in Chinese → PDF content in Chinese
  • User writes in English → PDF content in English
  • User explicitly specifies language → Follow user's specification
输出语言必须与用户查询语言一致。
  • 用户使用中文提问 → PDF内容为中文
  • 用户使用英文提问 → PDF内容为英文
  • 用户明确指定语言 → 遵循用户指定

2. Word Count and Page Constraints

2. 字数与页数约束

  • Strictly follow user-specified word/page count requirements
  • Do not arbitrarily inflate content length
  • 严格遵循用户指定的字数/页数要求
  • 不得随意增加内容长度

3. Citation and Search Standards

3. 引用与搜索标准

CRITICAL: Search Before Writing

关键要求:撰写前先搜索

DO NOT fabricate information. When in doubt, SEARCH.
If content involves ANY of these, you MUST search FIRST before writing:
  • Statistics, numbers, percentages, rankings
  • Policies, regulations, laws, standards
  • Academic research, theories, methodologies
  • Current events, recent developments
  • Anything you're not 100% certain about
<system-reminder> 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. </system-reminder>
不得编造信息。如有疑问,务必搜索。
如果内容涉及以下任何一项,您必须先搜索再撰写:
  • 统计数据、数字、百分比、排名
  • 政策、法规、法律、标准
  • 学术研究、理论、方法论
  • 时事、最新动态
  • 任何您无法100%确定的内容
<system-reminder> 如果需要统计数据、研究资料或政策信息,未搜索不得开始撰写。 严禁编造事实。如有不确定,先搜索。 </system-reminder>

When Search is Required

需要搜索的场景

ScenarioSearch?Notes
Statistics, dataRequirede.g., "2024 employment rate"
Policies, regulationsRequirede.g., "startup subsidies"
Research, papersRequirede.g., "effectiveness of method X"
Time-sensitive contentRequiredInformation after knowledge cutoff
Uncertain factsRequiredIf unsure, always search
Common knowledgeNot needede.g., "water boils at 100°C"
Search workflow:
  1. Identify facts/data requiring verification
  2. Search for authentic sources
  3. If results insufficient, iterate search until reliable info obtained
  4. Include real sources in references
  5. If search fails repeatedly, tell the user instead of making up data
场景是否需要搜索说明
统计数据、资料例如:"2024年就业率"
政策、法规例如:"创业补贴"
研究、论文例如:"方法X的有效性"
时效性内容知识库截止日期之后的信息
不确定的事实如有疑问,始终先搜索
常识例如:"水在100°C沸腾"
搜索流程:
  1. 识别需要验证的事实/数据
  2. 搜索可靠来源
  3. 如果结果不足,重复搜索直到获取可靠信息
  4. 在参考文献中包含真实来源
  5. 如果多次搜索失败,告知用户,不得编造数据

Citations Must Be Real

引用必须真实

Fabricating references is prohibited. All citations must have:
  • Correct author/institution names
  • Accurate titles
  • Verifiable year, journal/source
严禁编造参考文献。所有引用必须包含:
  • 正确的作者/机构名称
  • 准确的标题
  • 可验证的年份、期刊/来源

Cross-references (Must Be Clickable)

交叉引用(必须可点击)

html
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).

html
<a href="#fig-1-1">图1-1</a>所示...
根据<a href="#eq-2-1">公式(2-1)</a>...
详见<a href="#sec3">第3节</a>...
注意
id
必须放在容器顶部(查看html.md中的CSS计数器部分)。

Content Quality Constraints

内容质量约束

1. Word/Page Count Constraints

1. 字数/页数约束

Must strictly follow user-specified word or page count requirements:
User RequestExecution 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 requirementInfer 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:
  • Arbitrarily shortening content ("concise" is not an excuse)
  • Padding pages with excessive bullet lists (maintain high information density)
  • Exceeding twice the user's requested length
Special case - Resume/CV:
  • Resume should be 1 page unless user specifies otherwise
  • Use compact margins:
    margin: 1.5cm
必须严格遵循用户指定的字数或页数要求:
用户需求执行标准
具体字数(如"3000字")误差在±20%以内,即2400-3600字
具体页数(如"5页")严格符合,最后一页可部分内容
字数范围(如"2000-3000字")必须落在范围内
无明确要求根据文档类型合理推断;优先全面而非简略
最低字数要求(如"超过5000字")不超过2倍,即5000-10000字
禁止行为:
  • 随意缩短内容("简洁"不能成为借口)
  • 用过多项目符号填充页数(保持高信息密度)
  • 超过用户要求长度的2倍
特殊情况 - 简历/CV:
  • 简历默认1页,除非用户另有指定
  • 使用紧凑边距:
    margin: 1.5cm

2. Outline Adherence (Mandatory)

2. 大纲遵循(强制要求)

When user provides outline:
  • Strictly follow the user-provided outline structure
  • Section titles must match outline (minor wording adjustments OK, no level/order changes)
  • Do not add or remove sections arbitrarily
  • If outline seems problematic, ask user first before modifying
When no user outline:
  • Use standard structures based on document type:
    • Academic papers: IMRaD (Introduction-Methods-Results-Discussion) or Introduction-Literature Review-Methods-Results-Discussion-Conclusion
    • Business reports: Conclusion-first (Executive Summary → Detailed Analysis → Recommendations)
    • Technical docs: Overview → Principles → Usage → Examples → FAQ
    • Course assignments: Follow assignment structure requirements
  • Sections must have logical progression, no disconnects

当用户提供大纲时:
  • 严格遵循用户提供的大纲结构
  • 章节标题必须与大纲匹配(可做少量措辞调整,不得更改层级/顺序)
  • 不得随意添加或删除章节
  • 如果大纲存在问题,先询问用户再修改
当用户未提供大纲时:
  • 根据文档类型使用标准结构:
    • 学术论文: IMRaD(引言-方法-结果-讨论)或引言-文献综述-方法-结果-讨论-结论
    • 商业报告: 结论先行(执行摘要→详细分析→建议)
    • 技术文档: 概述→原理→使用方法→示例→常见问题
    • 课程作业: 遵循作业结构要求
  • 章节必须逻辑连贯,无脱节

Tech Stack Overview

技术栈概述

RouteToolsPurpose
HTMLPlaywright + Paged.jsHTML → PDF conversion
HTMLKaTeX, MermaidMath formulas, diagrams
ProcesspikepdfForm filling, page operations, metadata
ProcesspdfplumberText and table extraction
ProcessLibreOfficeOffice → PDF conversion
LaTeXTectonicLaTeX → PDF compilation
路径工具用途
HTMLPlaywright + Paged.jsHTML → PDF 转换
HTMLKaTeX, Mermaid数学公式、图表
Processpikepdf表单填写、页面操作、元数据处理
Processpdfplumber文本和表格提取
ProcessLibreOffice办公文档→PDF 转换
LaTeXTectonicLaTeX → PDF 编译