Featured projects#Open source

BabelDOC: A Bilingual Translation Library for PDF Papers

An open-source translation library that parses and reflows English PDF papers into a bilingual side-by-side document, using an LLM for translation while preserving formulas, tables, and other original layout as closely as possible; usable as a CLI or embedded in other programs.

Project facts

GitHub Ecosystem
Repositorygithub.com/funstory-ai/BabelDOC
License
AGPL-3.0
Language
Python
Stars
9,604
Data checked
2026-09-25

Snapshot figures reflect the check date and may change over time.

Reading academic papers in a foreign language often means switching back and forth between a translation tool and the original text — slow, and it breaks your train of thought. BabelDOC is an open-source PDF translation library from funstory-ai: it splits a document into structural pieces like text blocks and figures, hands them to an LLM for translation, then renders a bilingual PDF that follows the original layout — it can also produce a translation-only version. GitHubDaily recommended it in April 2025.

Core features

  • Bilingual output: translation and original can run side by side or alternate on facing pages, or you can output translation-only — both modes are switchable as needed.
  • Layout preservation: parsing and rendering happen in two separate stages, with options like formula font recognition and figure-region protection to stay as close to the original layout as possible.
  • LLM-powered translation: calls an LLM over an OpenAI-compatible interface, defaulting to gpt-4o-mini; the project recommends well-compatible models like glm-4-flash and deepseek-chat, and litellm can be used to reach even more models.
  • Glossary support: terms are extracted automatically by default, and you can also load a CSV glossary to keep key terminology consistent throughout.
  • Scanned documents and offline deployment: a built-in OCR workaround handles black-text-on-white-background scans; models and fonts can be packaged into offline assets, verified via SHA3-256, for use on internal networks.

Typical use cases

  • Generating a bilingual PDF while reading English-language literature, so you can view the original and the translation without switching between windows.
  • Embedding it as a translation engine in other programs: PDFMathTranslate-next already integrates it and offers a self-hosted WebUI, and there’s a ready-made Zotero plugin; the project recommends calling it from Python via pdf2zh next.
  • Batch processing: supports multiple files and specified page ranges, automatically splits and reassembles very long documents, and lets you lock in parameters via a TOML config.

Quick start

Requires Python 3.12 and uv; translation runs through an OpenAI-compatible interface:

uv tool install --python 3.12 BabelDOC
babeldoc --openai --openai-model "gpt-4o-mini" --openai-base-url "https://api.openai.com/v1" --openai-api-key "your-api-key" --files example.pdf

The first run downloads model and font assets; you can also pre-package these into an offline asset bundle for distribution to internal machines.

Summary

BabelDOC suits researchers and students who read a lot of English-language papers, as well as developers who want to embed PDF translation into their own products. A few things to note: the project is AGPL-3.0 licensed, so evaluate the copyleft implications before commercial use; translation depends on an OpenAI-compatible service; the project states the CLI is mainly for debugging and doesn’t come with end-user support, and the Python API is treated as internal; it’s mainly tuned for English-to-Chinese, table translation is still experimental, and output carries a watermark by default (which can be disabled). Overall the feature set is fairly complete and the project is actively maintained, but for complex layouts or non-English/Chinese language pairs, it’s worth test-translating a few pages before running a full batch.