EMAIL CTA

Get new AI workflows and automation case studies

Leave your email to receive new tutorials, tool breakdowns, and practical automation workflows. This CTA is tuned for leads, collaborations, and newsletter readers.

Subscribe to receive Charlii AI updates. Unsubscribe anytime, or use the contact page for collaboration requests.

Open contact page
Image in article

Full Bilingual Translation of PDF Documents While Preserving Layout, Supporting Google, DeepL, Ollama, and OpenAI Translation

A complete bilingual translation of PDF documents that retains the original layout, compatible with Google, DeepL, Ollama, and OpenAI translation services.

Words 168Read Time≈ 1 min
2024-11-14
2026-3-19

Bilingual translation of complete PDF documents with preserved formatting, supporting Google, DeepL, Ollama, and OpenAI translation

Github repository: https://github.com/Byaidu/PDFMathTranslate
notion image
notion image
  • • PDF document translation with bilingual comparison
  • • 📊 Preserve formulas and charts
  • • 📄 Preserve searchable table of contents
  • • 🌐 Support multiple translation services
Requires Python version >=3.8, <=3.12
Execute translation command in the command line to generate translated document example-zh.pdf and bilingual comparison document example-dual.pdf in the working directory, using Google as the default translation service
Refer to Google Languages Codes, DeepL Languages Codes
Refer to DeepLX
Environment variable build endpoint: {DEEPL_SERVER_URL}/{DEEPL_AUTH_KEY}/translate
  • • DEEPL_SERVER_URL (Optional), e.g., export DEEPL_SERVER_URL=https://api.deepl.com
  • • DEEPL_AUTH_KEY , e.g., export DEEPL_AUTH_KEY=xxx
Reference Ollama
Set environment variable build endpoint: {OLLAMA_HOST}/api/chat
  • • OLLAMA_HOST (Optional), e.g., export OLLAMA_HOST=https://localhost:11434
Reference SiliconCloud, Zhipu
Set environment variable build endpoint: {OPENAI_BASE_URL}/chat/completions
  • • OPENAI_BASE_URL (Optional), e.g., export OPENAI_BASE_URL=https://api.openai.com/v1
  • • OPENAI_API_KEY , e.g., export OPENAI_API_KEY=xxx