Skip to main content

Latex PDF Translator

Project description

English | 简体中文

PDFMathTranslate

PDF scientific paper translation and bilingual comparison.

  • 📊 Retain formulas and charts.

  • 📄 Preserve table of contents.

  • 🌐 Support multiple translation services.

Installation

Require Python version >=3.8, <=3.11

pip install -U "pdf2zh>=1.5.3"

Usage

Execute the translation command in the command line to generate the translated document example-zh.pdf and the bilingual document example-dual.pdf in the current directory.

Translate the entire document

pdf2zh example.pdf

Translate part of the document

pdf2zh example.pdf -p 1-3,5

Translate with the specified language

See Languages Codes.

pdf2zh example.pdf -li en -lo ja

Translate with Ollama

See Ollama.

pdf2zh example.pdf -s gemma2

Translate with DeepLX

See DeepLX.

  1. Set ENVs to construct an endpoint like {DEEPLX_URL}/{DEEPLX_TOKEN}/translate:

    • DEEPLX_URL, e.g., export DEEPLX_URL=https://api.deeplx.org
    • DEEPLX_TOKEN, e.g., export DEEPLX_TOKEN=ABCDEFG
  2. Run:

pdf2zh example.pdf -s deeplx

Use regex to specify formula fonts and characters that need to be preserved

pdf2zh example.pdf -f "(CM[^RT].*|MS.*|.*Ital)" -c "(\(|\||\)|\+|=|\d|[\u0080-\ufaff])"

Preview

image

image

image

Acknowledgement

Document merging: PyMuPDF

Document parsing: Pdfminer.six

Document extraction: MinerU

Multi-threaded translation: MathTranslate

Layout parsing: DocLayout-YOLO

Star History

Star History Chart

Project details


Release history Release notifications | RSS feed

This version

1.6.7

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf2zh-1.6.7.tar.gz (144.0 kB view details)

Uploaded Source

Built Distribution

pdf2zh-1.6.7-py3-none-any.whl (152.2 kB view details)

Uploaded Python 3

File details

Details for the file pdf2zh-1.6.7.tar.gz.

File metadata

  • Download URL: pdf2zh-1.6.7.tar.gz
  • Upload date:
  • Size: 144.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pdf2zh-1.6.7.tar.gz
Algorithm Hash digest
SHA256 038c4b0c2c09f7955f851c7120c526ced3de564338a6eb05a415704dd61ff452
MD5 70786a75a19c05e3f7a4d8a230928771
BLAKE2b-256 b58ee6b1da54590d3ea906d699020ba7c22de7484f5a78528432e70febd33947

See more details on using hashes here.

File details

Details for the file pdf2zh-1.6.7-py3-none-any.whl.

File metadata

  • Download URL: pdf2zh-1.6.7-py3-none-any.whl
  • Upload date:
  • Size: 152.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pdf2zh-1.6.7-py3-none-any.whl
Algorithm Hash digest
SHA256 33d104dfab1959e3c72452fd8dbe9a02d7cbbc4270c67e501b5f5e6c494fb5b3
MD5 a9e56907ead913380a4de2b655629ce4
BLAKE2b-256 3113be34a9551adad7f766d1a3e639647624f0d3eaa4ce7f67da278b51432b05

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page