Skip to main content
wshuyi

translate-pdf

by wshuyiv1.0.0

Translate PDF documents to any language while preserving original structure, layout, and styling

Installation guide →
1 skillMIT GitHub

Keywords

pdftranslatetranslationmultilingualdocument

Documentation

[English](README.md) | [中文](README_CN.md)

# Translate PDF Skill

Translate PDF documents to any language while preserving the original structure, layout, colors, and styling.

## The Problem

Translating PDF documents is typically painful:
- Copy-paste loses all formatting
- Online tools mangle the layout
- Professional translation services are expensive and slow
- Technical diagrams and org charts are especially difficult

## The Solution

This Claude Code skill translates PDF text **in place**, preserving:
- ✅ Original layout and positions
- ✅ Background colors (yellow boxes, blue headers, etc.)
- ✅ Font sizes and text colors
- ✅ Document structure

**Translation time: ~1 minute** vs hours of manual work.

## Requirements

- Python 3.8+
- pymupdf (`pip install pymupdf`)
- Claude Code CLI

## Installation

### Method 1: Git Clone

```bash
git clone https://github.com/wshuyi/translate-pdf-skill.git
cp -r translate-pdf-skill/skills/translate-pdf ~/.claude/skills/
```

### Method 2: Plugin Marketplace

```bash
/plugin install translate-pdf@wshuyi/translate-pdf-skill
```

## Usage

Simply tell Claude what you want:

```
"Translate this PDF to Chinese"
"把这个PDF翻译成英文"
"Translate report.pdf to Japanese"
```

Claude will:
1. Extract all text from the PDF
2. Translate to target language
3. Replace text while preserving styling
4. Output translated PDF

## Supported Languages

| Language | Font |
|----------|------|
| English, Spanish, Portuguese, French, German, etc. | helv |
| Simplified Chinese | china-ss |
| Traditional Chinese | china-ts |
| Japanese | japan |
| Korean | korea |

## Example

**Input**: Portuguese organizational chart (Suprimentos.pdf)

**Command**: "把这个PDF翻译成中文"

**Output**: Chinese version with identical layout and styling

## How It Works

1. **Extract**: Parses PDF to get all text spans with positions, fonts, and colors
2. **Translate**: Claude translates each text string
3. **Replace**: Uses PDF redaction (transparent fill) to remove original text
4. **Insert**: Adds translated text at same positions with matching style

## FAQ

**Q: Does it work with scanned PDFs?**
A: No, this skill works with text-based PDFs. Scanned documents need OCR first.

**Q: Will it change my PDF layout?**
A: No, the layout is preserved. Only the text content changes.

**Q: What about images and charts?**
A: Images are preserved. Text within the PDF is translated.

## License

MIT License - see [LICENSE](LICENSE)

## Author

[@wshuyi](https://github.com/wshuyi)

---

🤖 Generated with [Claude Code](https://claude.com/claude-code)