Skip to main content
skill CX Codex

translate-pdf — Claude Code skill: translate PDFs, keep layout

Translates the text inside a PDF into another language and puts it back in place, keeping structure, colors and backgrounds. Useful when you need a translated document, not a rebuilt one.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add wshuyi/translate-pdf-skill --skill translate-pdf -a claude-code
Open on GitHub

What translate-pdf does

The skill runs in three steps. scripts/extract_texts.py pulls every unique string out of the PDF, you translate them into translations.json saved next to the source file, then scripts/translate_pdf.py writes the translations back. Colors, backgrounds and block positions stay untouched.

Pick the font with the --font flag: helv for Latin scripts, china-ss and china-ts for Simplified and Traditional Chinese, japan for Japanese, korea for Korean. For Chinese, Japanese or Korean output the font is not optional — without it the glyphs will not render. CJK fonts auto-scale to 90% so the translated text fits the original boxes.

The output file gets a language suffix: filename_EN.pdf, filename_ZH.pdf, filename_JA.pdf. Proper nouns, abbreviations and technical terms are left alone, so you can keep them as-is while building the mapping. You need Python and a filled-in translations.json; the second script has nothing to run without it.

What it helps with

  • translate a contract into English without breaking its layout
  • produce a Chinese version of a finished PDF deck
  • prepare a Japanese translation that keeps the original colors
  • extract every string from a PDF and map translations back
  • get a copy of the file with a language suffix next to the source

Example prompts for the agent

  • translate this PDF to English and keep the layout
  • make a Chinese version of report.pdf with the china-ss font
  • extract the texts from manual.pdf and build the translation file

How to install translate-pdf

1Skills CLI (Vercel)

npx skills add wshuyi/translate-pdf-skill --skill translate-pdf -a claude-code

2Manually: put the files in place

~/.claude/skills/translate-pdf/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/translate-pdf/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about translate-pdf

How do I install translate-pdf in Claude?

Run npx skills add wshuyi/translate-pdf-skill --skill translate-pdf -a claude-code. The skill lands in ~/.claude/skills/translate-pdf/SKILL.md.

What does translate-pdf do?

It translates the text inside a PDF and places it back at the same coordinates, preserving colors, backgrounds and block positions. The result is a new file with a language suffix in its name.

Which font should I use for Chinese or Japanese?

Use china-ss for Simplified Chinese, china-ts for Traditional, japan for Japanese and korea for Korean. Latin text works with helv.

Source text

SKILL.md · MIT
---
name: translate-pdf
description: |
  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", "翻译成中文/英文"
---

# 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:**
| Font | Language |
|------|----------|
| `helv` | Latin (English, Spanish, Portuguese, French, German, etc.) |
| `china-ss` | Simplified Chinese |
| `china-ts` | Traditional Chinese |
| `japan` | Japanese |
| `korea` | Korean |

## 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 · MIT · wshuyi/translate-pdf-skill

Similar skills

Everything for Office documents →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor