Translate Pdf

wshuyi/translate-pdf-skill/skills/translate-pdf

作者 wshuyi5836f0de12d9bd173187f01dfd9efaf992fcaae2无许可证收录于 2026年10月9日更新于 2026年10月9日

Translate PDF documents to any language while preserving original structure, layout, and styling (colors, backgrounds, positions). Use when user wants to: (1) translate a PDF to another language, (2) convert PDF from one language to another, (3) create translated version of PDF document. Triggers: "translate PDF", "PDF翻译", "把PDF翻译成", "translate this PDF to Chinese/English/Japanese", "翻译成中文/英文"

AI 生成的概览

将 PDF 文档翻译成其他语言,同时保留原有版式、颜色和背景样式。

功能
该技能先提取 PDF 中的全部不重复文本,由智能体生成原文到译文的 JSON 映射,再将译文写回 PDF。它附带两个 Python 脚本:一个用于提取文本,一个用于按指定字体应用翻译。最终生成保留原有结构和样式的新 PDF。
适用场景
当用户需要把 PDF 翻译成另一种语言、从一种语言转换为另一种语言,或生成原文档的翻译版本时使用。适用于“把 PDF 翻译成中文/英文/日文”等请求。
运行要求
需要 Python 运行环境来执行随附的两个脚本,以及 PDF 输入文件和翻译 JSON 文件。字体需按目标语言选择(拉丁、简体中文、繁体中文、日文或韩文)。

PDF Translation

Translate PDF text while preserving structure, colors, and background styling.

Workflow

Step 1: Extract texts

bash
python {skill_path}/scripts/extract_texts.py <input.pdf>

Review output to see all unique text strings in the PDF.

Step 2: Create translation mapping

Translate each text to target language. Create JSON file:

json
{  "Original Text 1": "Translated 1",  "Original Text 2": "Translated 2"}

Save as translations.json next to input PDF.

Step 3: Apply translations

bash
python {skill_path}/scripts/translate_pdf.py <input.pdf> translations.json <output.pdf> --font <fontname>

Font options:

FontLanguage
helvLatin (English, Spanish, Portuguese, French, German, etc.)
china-ssSimplified Chinese
china-tsTraditional Chinese
japanJapanese
koreaKorean

Output naming

Append language suffix: filename_EN.pdf, filename_ZH.pdf, filename_JA.pdf

Tips

  • Keep proper nouns, abbreviations, technical terms unchanged when appropriate
  • CJK fonts auto-scale to 90% for better fit
  • Use transparent fill to preserve original background colors

来源与署名

来源:wshuyi/translate-pdf-skill位于skills/translate-pdf提交5836f0d

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架