minimax-pdf

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

minimax-pdf

minimax-pdf

Three tasks. One skill.
三项任务,一个Skill。

Read
design/design.md
before any CREATE or REFORMAT work.

在进行任何CREATE或REFORMAT操作前,请阅读
design/design.md



Route table

路由表

User intentRouteScripts used
Generate a new PDF from scratchCREATE
palette.py
cover.py
render_cover.js
render_body.py
merge.py
Fill / complete form fields in an existing PDFFILL
fill_inspect.py
fill_write.py
Reformat / re-style an existing documentREFORMAT
reformat_parse.py
→ then full CREATE pipeline
Rule: when in doubt between CREATE and REFORMAT, ask whether the user has an existing document to start from. If yes → REFORMAT. If no → CREATE.

用户意图处理路径使用的脚本
从头生成新PDFCREATE
palette.py
cover.py
render_cover.js
render_body.py
merge.py
填写现有PDF中的表单字段FILL
fill_inspect.py
fill_write.py
重新格式化/重新设置现有文档样式REFORMAT
reformat_parse.py
→ 完整CREATE流程
规则: 若无法区分CREATE和REFORMAT,请询问用户是否有可作为基础的现有文档。若是 → 选择REFORMAT;若否 → 选择CREATE。

Route A: CREATE

路径A:CREATE

Full pipeline — content → design tokens → cover → body → merged PDF.
bash
bash scripts/make.sh run \
  --title "Q3 Strategy Review" --type proposal \
  --author "Strategy Team" --date "October 2025" \
  --accent "#2D5F8A" \
  --content content.json --out report.pdf
Doc types:
report
·
proposal
·
resume
·
portfolio
·
academic
·
general
·
minimal
·
stripe
·
diagonal
·
frame
·
editorial
·
magazine
·
darkroom
·
terminal
·
poster
TypeCover patternVisual identity
report
fullbleed
Dark bg, dot grid, Playfair Display
proposal
split
Left panel + right geometric, Syne
resume
typographic
Oversized first-word, DM Serif Display
portfolio
atmospheric
Near-black, radial glow, Fraunces
academic
typographic
Light bg, classical serif, EB Garamond
general
fullbleed
Dark slate, Outfit
minimal
minimal
White + single 8px accent bar, Cormorant Garamond
stripe
stripe
3 bold horizontal color bands, Barlow Condensed
diagonal
diagonal
SVG angled cut, dark/light halves, Montserrat
frame
frame
Inset border, corner ornaments, Cormorant
editorial
editorial
Ghost letter, all-caps title, Bebas Neue
magazine
magazine
Warm cream bg, centered stack, hero image, Playfair Display
darkroom
darkroom
Navy bg, centered stack, grayscale image, Playfair Display
terminal
terminal
Near-black, grid lines, monospace, neon green
poster
poster
White bg, thick sidebar, oversized title, Barlow Condensed
Cover extras (inject into tokens via
--abstract
,
--cover-image
):
  • --abstract "text"
    — abstract text block on the cover (magazine/darkroom)
  • --cover-image "url"
    — hero image URL/path (magazine, darkroom, poster)
Color overrides — always choose these based on document content:
  • --accent "#HEX"
    — override the accent color;
    accent_lt
    is auto-derived by lightening toward white
  • --cover-bg "#HEX"
    — override the cover background color
Accent color selection guidance:
You have creative authority over the accent color. Pick it from the document's semantic context — title, industry, purpose, audience — not from generic "safe" choices. The accent appears on section rules, callout bars, table headers, and the cover: it carries the document's visual identity.
ContextSuggested accent range
Legal / compliance / financeDeep navy
#1C3A5E
, charcoal
#2E3440
, slate
#3D4C5E
Healthcare / medicalTeal-green
#2A6B5A
, cool green
#3A7D6A
Technology / engineeringSteel blue
#2D5F8A
, indigo
#3D4F8A
Environmental / sustainabilityForest
#2E5E3A
, olive
#4A5E2A
Creative / arts / cultureBurgundy
#6B2A35
, plum
#5A2A6B
, terracotta
#8A3A2A
Academic / researchDeep teal
#2A5A6B
, library blue
#2A4A6B
Corporate / neutralSlate
#3D4A5A
, graphite
#444C56
Luxury / premiumWarm black
#1A1208
, deep bronze
#4A3820
Rule: choose a color that a thoughtful designer would select for this specific document — not the type's default. Muted, desaturated tones work best; avoid vivid primaries. When in doubt, go darker and more neutral.
content.json block types:
BlockUsageKey fields
h1
Section heading + accent rule
text
h2
Subsection heading
text
h3
Sub-subsection (bold)
text
body
Justified paragraph; supports
<b>
<i>
markup
text
bullet
Unordered list item (• prefix)
text
numbered
Ordered list item — counter auto-resets on non-numbered blocks
text
callout
Highlighted insight box with accent left bar
text
table
Data table — accent header, alternating row tints
headers
,
rows
,
col_widths
?,
caption
?
image
Embedded image scaled to column width
path
/
src
,
caption
?
figure
Image with auto-numbered "Figure N:" caption
path
/
src
,
caption
?
code
Monospace code block with accent left border
text
,
language
?
math
Display math — LaTeX syntax via matplotlib mathtext
text
,
label
?,
caption
?
chart
Bar / line / pie chart rendered with matplotlib
chart_type
,
labels
,
datasets
,
title
?,
x_label
?,
y_label
?,
caption
?,
figure
?
flowchart
Process diagram with nodes + edges via matplotlib
nodes
,
edges
,
caption
?,
figure
?
bibliography
Numbered reference list with hanging indent
items
[{id, text}],
title
?
divider
Accent-colored full-width rule
caption
Small muted label
text
pagebreak
Force a new page
spacer
Vertical whitespace
pt
(default 12)
chart / flowchart schemas:
json
{"type":"chart","chart_type":"bar","labels":["Q1","Q2","Q3","Q4"],
 "datasets":[{"label":"Revenue","values":[120,145,132,178]}],"caption":"Q results"}

{"type":"flowchart",
 "nodes":[{"id":"s","label":"Start","shape":"oval"},
          {"id":"p","label":"Process","shape":"rect"},
          {"id":"d","label":"Valid?","shape":"diamond"},
          {"id":"e","label":"End","shape":"oval"}],
 "edges":[{"from":"s","to":"p"},{"from":"p","to":"d"},
          {"from":"d","to":"e","label":"Yes"},{"from":"d","to":"p","label":"No"}]}

{"type":"bibliography","items":[
  {"id":"1","text":"Author (Year). Title. Publisher."}]}

完整流程 — 内容 → 设计令牌 → 封面 → 正文 → 合并PDF。
bash
bash scripts/make.sh run \
  --title "Q3 Strategy Review" --type proposal \
  --author "Strategy Team" --date "October 2025" \
  --accent "#2D5F8A" \
  --content content.json --out report.pdf
文档类型:
report
·
proposal
·
resume
·
portfolio
·
academic
·
general
·
minimal
·
stripe
·
diagonal
·
frame
·
editorial
·
magazine
·
darkroom
·
terminal
·
poster
类型封面样式视觉标识
report
fullbleed
(全屏 bleed)
深色背景、点阵网格、Playfair Display字体
proposal
split
(分栏)
左侧面板+右侧几何图形、Syne字体
resume
typographic
(排版导向)
超大首字、DM Serif Display字体
portfolio
atmospheric
(氛围感)
近黑色、径向渐变、Fraunces字体
academic
typographic
(排版导向)
浅色背景、经典衬线体、EB Garamond字体
general
fullbleed
(全屏 bleed)
深灰蓝、Outfit字体
minimal
minimal
(极简)
白色+单条8px强调栏、Cormorant Garamond字体
stripe
stripe
(条纹)
3条粗色水平带、Barlow Condensed字体
diagonal
diagonal
(斜切)
SVG斜角切割、深浅分块、Montserrat字体
frame
frame
(边框)
内嵌边框、角落装饰、Cormorant字体
editorial
editorial
(社论风)
虚影文字、全大写标题、Bebas Neue字体
magazine
magazine
(杂志风)
暖奶油色背景、居中堆叠、主图、Playfair Display字体
darkroom
darkroom
(暗房风)
藏青背景、居中堆叠、灰度图、Playfair Display字体
terminal
terminal
(终端风)
近黑色、网格线等宽字体、霓虹绿
poster
poster
(海报风)
白色背景、粗侧边栏、超大标题、Barlow Condensed字体
封面额外选项(通过
--abstract
--cover-image
注入令牌):
  • --abstract "text"
    — 封面添加摘要文本块(适用于magazine/darkroom类型)
  • --cover-image "url"
    — 主图URL/路径(适用于magazine、darkroom、poster类型)
颜色覆盖选项 — 请始终根据文档内容选择:
  • --accent "#HEX"
    — 覆盖强调色;
    accent_lt
    会自动通过向白色提亮生成
  • --cover-bg "#HEX"
    — 覆盖封面背景色
强调色选择指南:
你对强调色拥有创意决策权。请根据文档的语义语境(标题、行业、用途、受众)选择,而非通用的“安全”选项。强调色会出现在章节分隔线、提示栏、表格表头和封面上:它承载着文档的视觉标识。
语境推荐强调色范围
法律/合规/金融深藏青
#1C3A5E
、炭黑
#2E3440
、灰蓝
#3D4C5E
医疗/健康青绿
#2A6B5A
、冷绿
#3A7D6A
科技/工程钢蓝
#2D5F8A
、靛蓝
#3D4F8A
环境/可持续发展森林绿
#2E5E3A
、橄榄绿
#4A5E2A
创意/艺术/文化酒红
#6B2A35
、紫李
#5A2A6B
、赤陶
#8A3A2A
学术/研究深青绿
#2A5A6B
、图书馆蓝
#2A4A6B
企业/中性灰蓝
#3D4A5A
、石墨灰
#444C56
奢侈品/高端暖黑
#1A1208
、深古铜
#4A3820
规则: 选择一位有想法的设计师会为该特定文档挑选的颜色 — 而非类型默认色。柔和、低饱和度的色调效果最佳;避免鲜艳的原色。若有疑问,选择更深、更中性的颜色。
content.json块类型:
块类型用途关键字段
h1
章节标题+强调分隔线
text
h2
子章节标题
text
h3
三级子标题(加粗)
text
body
两端对齐段落;支持
<b>
<i>
标记
text
bullet
无序列表项(前缀为•)
text
numbered
有序列表项 — 计数器会在非编号块处自动重置
text
callout
带左侧强调栏的高亮提示框
text
table
数据表格 — 强调色表头、交替行底色
headers
,
rows
,
col_widths
(可选),
caption
(可选)
image
嵌入图片,缩放至列宽
path
/
src
,
caption
(可选)
figure
带自动编号“图N:”标题的图片
path
/
src
,
caption
(可选)
code
带左侧强调边框的等宽代码块
text
,
language
(可选)
math
显示数学公式 — 通过matplotlib mathtext支持LaTeX语法
text
,
label
(可选),
caption
(可选)
chart
用matplotlib渲染的柱状图/折线图/饼图
chart_type
,
labels
,
datasets
,
title
(可选),
x_label
(可选),
y_label
(可选),
caption
(可选),
figure
(可选)
flowchart
用matplotlib渲染的带节点+边的流程图
nodes
,
edges
,
caption
(可选),
figure
(可选)
bibliography
带悬挂缩进的编号参考文献列表
items
[{id, text}],
title
(可选)
divider
强调色全宽分隔线
caption
小型柔和标签
text
pagebreak
强制分页
spacer
垂直空白
pt
(默认12)
图表/流程图示例:
json
{"type":"chart","chart_type":"bar","labels":["Q1","Q2","Q3","Q4"],
 "datasets":[{"label":"Revenue","values":[120,145,132,178]}],"caption":"Q results"}

{"type":"flowchart",
 "nodes":[{"id":"s","label":"Start","shape":"oval"},
          {"id":"p","label":"Process","shape":"rect"},
          {"id":"d","label":"Valid?","shape":"diamond"},
          {"id":"e","label":"End","shape":"oval"}],
 "edges":[{"from":"s","to":"p"},{"from":"p","to":"d"},
          {"from":"d","to":"e","label":"Yes"},{"from":"d","to":"p","label":"No"}]}

{"type":"bibliography","items":[
  {"id":"1","text":"Author (Year). Title. Publisher."}]}

Route B: FILL

路径B:FILL

Fill form fields in an existing PDF without altering layout or design.
bash
undefined
在不改变布局或设计的情况下填写现有PDF的表单字段。
bash
undefined

Step 1: inspect

Step 1: 检查

python3 scripts/fill_inspect.py --input form.pdf
python3 scripts/fill_inspect.py --input form.pdf

Step 2: fill

Step 2: 填写

python3 scripts/fill_write.py --input form.pdf --out filled.pdf
--values '{"FirstName": "Jane", "Agree": "true", "Country": "US"}'

| Field type | Value format |
|---|---|
| `text` | Any string |
| `checkbox` | `"true"` or `"false"` |
| `dropdown` | Must match a choice value from inspect output |
| `radio` | Must match a radio value (often starts with `/`) |

Always run `fill_inspect.py` first to get exact field names.

---
python3 scripts/fill_write.py --input form.pdf --out filled.pdf
--values '{"FirstName": "Jane", "Agree": "true", "Country": "US"}'

| 字段类型 | 值格式 |
|---|---|
| `text` | 任意字符串 |
| `checkbox` | `"true"`或`"false"` |
| `dropdown` | 必须与检查输出中的选项值匹配 |
| `radio` | 必须与单选按钮值匹配(通常以`/`开头) |

请始终先运行`fill_inspect.py`以获取准确的字段名称。

---

Route C: REFORMAT

路径C:REFORMAT

Parse an existing document → content.json → CREATE pipeline.
bash
bash scripts/make.sh reformat \
  --input source.md --title "My Report" --type report --out output.pdf
Supported input formats:
.md
.txt
.pdf
.json

解析现有文档 → 生成content.json → 进入CREATE流程。
bash
bash scripts/make.sh reformat \
  --input source.md --title "My Report" --type report --out output.pdf
支持的输入格式:
.md
.txt
.pdf
.json

Environment

环境要求

bash
bash scripts/make.sh check   # verify all deps
bash scripts/make.sh fix     # auto-install missing deps
bash scripts/make.sh demo    # build a sample PDF
ToolUsed byInstall
Python 3.9+all
.py
scripts
system
reportlab
render_body.py
pip install reportlab
pypdf
fill, merge, reformat
pip install pypdf
Node.js 18+
render_cover.js
system
playwright
+ Chromium
render_cover.js
npm install -g playwright && npx playwright install chromium
bash
bash scripts/make.sh check   # 验证所有依赖
bash scripts/make.sh fix     # 自动安装缺失的依赖
bash scripts/make.sh demo    # 生成示例PDF
工具使用者安装方式
Python 3.9+所有
.py
脚本
系统安装
reportlab
render_body.py
pip install reportlab
pypdf
填充、合并、重新格式化
pip install pypdf
Node.js 18+
render_cover.js
系统安装
playwright
+ Chromium
render_cover.js
npm install -g playwright && npx playwright install chromium