Files
agent/skills/x2pdf/AGENTS.md
T
kicer 25f9e157ad docs(skills): 排错清单统一成「报错 → 怎么办 → 命令」,office 改为建软链
技能目录的 AGENTS.md 只在报错时被读,所以只写「报错原文 → 怎么办 → 命令」,一节一个
现象,不写背景。命令块前统一声明「仅为示例,具体以本机平台实际情况为准」——路径分隔符、
可执行名、包管理器交给模型按本机情况自愈,不逐平台列出。

office:`command not found` 从按次拼 PATH 前缀改成建一次 $HOME/.local/bin/office 软链。
每条 terminal 命令都是新 shell,前缀不跨命令生效,按次拼的写法容易被反复踩。
image-process:PIL 缺包与「中文水印缺字体」拆成两节。
x2pdf:后端代价表压成三条列表,四个现象(ModuleNotFoundError / 没有可用排版能力 /
could not import some external libraries / 排版降级)各自成节。
document-photo-to-pdf:单节化,保留 fitz 是 pymupdf 的 import 名这条坑。
data-page 只用标准库,不需要 AGENTS.md。
2026-11-12 10:05:46 +08:00

36 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# x2pdf
以下命令仅为示例,具体以本机平台实际情况为准。
## ModuleNotFoundError: markdown
把依赖装进 `$AGENT_SKILLS_DEPS`。
```sh
python3 -m pip install --upgrade --target "$AGENT_SKILLS_DEPS" -r "$(dirname "$AGENT_SKILLS_DEPS")/x2pdf/requirements.txt"
```
## 没有可用的 PDF 排版能力
文本类有三个后端可退,从便宜到贵补,别一次全装:
- 浏览器:有 Chrome / Chromium / Edge 就自动用,通常不用装
- LibreOffice:Office 类(docx/xlsx/pptx)必装——Linux `apt install libreoffice`;macOS `brew install --cask libreoffice`;Windows `winget install TheDocumentFoundation.LibreOffice`
- WeasyPrint:先装上面的 Python 包,再补系统库 pango/cairo(见下节)
系统级安装几百 MB,先跟用户说清代价,由他决定装还是接受降级。
## could not import some external libraries
系统库没到位,不是 Python 包的问题:Linux `apt install libpango-1.0-0 libpangocairo-1.0-0 libcairo2`;macOS `brew install pango`;Windows 补 GTK 运行库,装不上就跳过。
装完验证:
```sh
python3 -c "import weasyprint; print(weasyprint.__version__)"
```
## 输出带「排版降级」
无页码或边距偏差不是失败,是后端不全,按需补。