Back to rankings

Byaidu/PDFMathTranslate

Pythonpdf2zh.com

PDF scientific paper translation with preserved formats - 基于 AI 完整保留排版的 PDF 文档全文双语翻译,支持 Google/DeepL/Ollama/OpenAI 等服务,提供 CLI/GUI/Docker/Zotero

chineselatexpdftranslationkoreanenglishjapaneseopenaipdf2zhrussianpythontranslate
Stars
18.3k
Forks
1.5k
Weekly Growth
Issues
155
ArtifactsPyPIpip install pdfmathtranslate
README

PDF scientific paper translation and bilingual comparison.

Feel free to provide feedback in GitHub Issues or Telegram Group.

For details on how to contribute, please consult the Contribution Guide.

Updates

  • [Mar. 3, 2025] Experimental support for the new backend BabelDOC WebUI added as an experimental option (by @awwaawwa)
  • [Feb. 22 2025] Better release CI and well-packaged windows-amd64 exe (by @awwaawwa)
  • [Dec. 24 2024] The translator now supports local models on Xinference (by @imClumsyPanda)
  • [Dec. 19 2024] Non-PDF/A documents are now supported using -cp (by @reycn)
  • [Dec. 13 2024] Additional support for backend by (by @YadominJinta)
  • [Dec. 10 2024] The translator now supports OpenAI models on Azure (by @yidasanqian)

Preview

Online Service 🌟

You can try our application out using either of the following demos:

Note that the computing resources of the demo are limited, so please avoid abusing them.

Installation and Usage

Methods

For different use cases, we provide distinct methods to use our program:

1. UV install
  1. Python installed (3.10 <= version <= 3.12)

  2. Install our package:

    pip install uv
    uv tool install --python 3.12 pdf2zh
    
  3. Execute translation, files generated in current working directory:

    pdf2zh document.pdf
    
2. Windows exe
  1. Download pdf2zh-version-win64.zip from release page

  2. Unzip and double-click pdf2zh.exe to run.

3. Graphic user interface 1. Python installed (3.10 <= version <= 3.12) 2. Install our package:
pip install pdf2zh
  1. Start using in browser:

    pdf2zh -i
    
  2. If your browswer has not been started automatically, goto

    http://localhost:7860/
    

See documentation for GUI for more details.

4. Docker
  1. Pull and run:

    docker pull byaidu/pdf2zh
    docker run -d -p 7860:7860 byaidu/pdf2zh
    
  2. Open in browser:

    http://localhost:7860/
    

For docker deployment on cloud service:

5. Zotero Plugin

See Zotero PDF2zh for more details.

6. Commandline
  1. Python installed (3.10 <= version <= 3.12)

  2. Install our package:

    pip install pdf2zh
    
  3. Execute translation, files generated in current working directory:

    pdf2zh document.pdf
    

[!TIP]

docker pull ghcr.io/byaidu/pdfmathtranslate
docker run -d -p 7860:7860 ghcr.io/byaidu/pdfmathtranslate

Unable to install?

The present program needs an AI model(wybxc/DocLayout-YOLO-DocStructBench-onnx) before working and some users are not able to download due to network issues. If you have a problem with downloading this model, we provide a workaround using the following environment variable:

set HF_ENDPOINT=https://hf-mirror.com

For PowerShell user:

$env:HF_ENDPOINT = https://hf-mirror.com

If the solution does not work to you / you encountered other issues, please refer to frequently asked questions.

Advanced Options

Execute the translation command in the command line to generate the translated document example-mono.pdf and the bilingual document example-dual.pdf in the current working directory. Use Google as the default translation service. More support translation services can find HERE.

cmd

In the following table, we list all advanced options for reference:

Option Function Example
files Local files pdf2zh ~/local.pdf
links Online files pdf2zh http://arxiv.org/paper.pdf
-i Enter GUI pdf2zh -i
-p Partial document translation pdf2zh example.pdf -p 1
-li Source language pdf2zh example.pdf -li en
-lo Target language pdf2zh example.pdf -lo zh
-s Translation service pdf2zh example.pdf -s deepl
-t Multi-threads pdf2zh example.pdf -t 1
-o Output dir pdf2zh example.pdf -o output
-f, -c Exceptions pdf2zh example.pdf -f "(MS.*)"
-cp Compatibility Mode pdf2zh example.pdf --compatible
--skip-subset-fonts Skip font subset pdf2zh example.pdf --skip-subset-fonts
--share Public link pdf2zh -i --share
--authorized Authorization pdf2zh -i --authorized users.txt [auth.html]
--prompt Custom Prompt pdf2zh --prompt [prompt.txt]
--onnx [Use Custom DocLayout-YOLO ONNX model] pdf2zh --onnx [onnx/model/path]
--serverport [Use Custom WebUI port] pdf2zh --serverport 7860
--dir [batch translate] pdf2zh --dir /path/to/translate/
--config configuration file pdf2zh --config /path/to/config/config.json
--serverport [custom gradio server port] pdf2zh --serverport 7860
--babeldoc Use Experimental backend BabelDOC to translate pdf2zh --babeldoc -s openai example.pdf

For detailed explanations, please refer to our document about Advanced Usage for a full list of each option.

Secondary Development (APIs)

For downstream applications, please refer to our document about API Details for futher information about:

  • Python API, how to use the program in other Python programs
  • HTTP API, how to communicate with a server with the program installed

TODOs

  • Parse layout with DocLayNet based models, PaddleX, PaperMage, SAM2

  • Fix page rotation, table of contents, format of lists

  • Fix pixel formula in old papers

  • Async retry except KeyboardInterrupt

  • Knuth–Plass algorithm for western languages

  • Support non-PDF/A files

  • Plugins of Zotero and Obsidian

Acknowledgements

Contributors

Alt

Star History

Star History Chart
Related repositories
Anduin2017/HowToCook

Programmer's guide about how to cook at home.

The Unlicensecookbookrecipes
howtocook.aiursoft.com
101.3k11k
d2l-ai/d2l-zh

《动手学深度学习》:面向中文读者、能运行、可讨论。中英文版被70多个国家的500多所大学用于教学。

PythonPyPIApache License 2.0deep-learningbook
zh.d2l.ai
79.1k12.3k
byoungd/up

An advanced guide which might benefit you a lot 🎉 . 人生进阶指南 离谱的人生 离谱的英语学习指南/英语学习教程/英语学习/学英语

JavaScriptnpmchinesetutorial
token.love
56k5.7k
chinese-poetry/chinese-poetry

The most comprehensive database of Chinese poetry 🧶最全中华古诗词数据库, 唐宋两朝近一万四千古诗人, 接近5.5万首唐诗加26万宋诗. 两宋时期1564位词人,21050首词。

JavaScriptnpmMIT Licensejsonchinese
awesome-poetry.top
52.6k10.6k
2noise/ChatTTS

A generative speech model for daily dialogue.

PythonPyPIGNU Affero General Public License v3.0agenttext-to-speech
2noise.com
39.7k4.2k
byoungd/English-level-up-tips

An advanced guide to learn English which might benefit you a lot 🎉 . 离谱的英语学习指南/英语学习教程。

HTMLchinesetutorial
byoungd.github.io/English-level-up-tips/
38k4.2k
PDFMathTranslate/PDFMathTranslate

[EMNLP 2025 Demo] PDF scientific paper translation with preserved formats - 基于 AI 完整保留排版的 PDF 文档全文双语翻译,支持 Google/DeepL/Ollama/OpenAI 等服务,提供 CLI/GUI/MCP/Docker/Zotero

PythonPyPIGNU Affero General Public License v3.0chineselatex
pdf2zh.com
35.7k3.2k
sunface/rust-course

什么?你敢放心的把后背交给 AI? 我赌你不敢,那就来学学 AI 时代最酷、最安全、最快的语言吧。本书拥有全面且深入的讲解、生动贴切的示例、德芙般丝滑的内容,这可能是目前最用心的 Rust 中文学习教程 / Book

Rustcrates.iorust-langrust
course.rs
30.7k2.6k
Z-Siqi/Clash-for-Windows_Chinese

clash for windows汉化版. 提供clash for windows的汉化版, 汉化补丁及汉化版安装程序

JavaScriptnpmclashwindows
28.4k3.2k
xiaojieonly/Ehviewer_CN_SXJ

ehviewer,用爱发电,快乐前行

COtherscreenshotehviewer
25.5k669
AccumulateMore/CV

✅(已完结)超级全面的 深度学习 笔记【土堆 Pytorch】【李沐 动手学深度学习】【吴恩达 深度学习】【大飞 大模型Agent】

Jupyter Notebookbookchinese
22.8k2.6k
AiHubCN/Awesome-Chinese-LLM

整理开源的中文大语言模型,以规模较小、可私有化部署、训练成本较低的模型为主,包括底座模型,垂直领域微调及应用,数据集与教程等。

llmnlp
22.7k2.1k