---
title: "Deploy PDFMathTranslate"
description: "Translate scientific PDFs with formulas and layout kept; web UI with login"
category: "AI/ML"
url: https://railway.com/deploy/pdfmathtranslate-1
---

# Deploy PDFMathTranslate

Translate scientific PDFs with formulas and layout kept; web UI with login

**[Deploy PDFMathTranslate on Railway](https://railway.com/template/pdfmathtranslate-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/pdfmathtranslate-1/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** AI/ML
- **Total deploys:** 2

## Template content

### pdfmathtranslate https://raw.githubusercontent.com/PDFMathTranslate/PDFMathTranslate-next/07022b4d8585330c6b8413dd2cea9d203d1efb36/docs/images/logo_photo.svg

- **Source:** https://github.com/aalfath/pdfmathtranslate-railway-template
- **Health check:** /
- **Public domain:** Yes

## Documentation

# Deploy and Host PDFMathTranslate on Railway

PDFMathTranslate (pdf2zh) translates scientific PDFs while keeping the original layout: formulas, charts, tables, the table of contents and annotations stay in place. It writes a translated-only PDF and a side-by-side bilingual PDF. It works with free Bing translation out of the box, or with your own LLM or translation API key.

## About Hosting PDFMathTranslate

This template runs the official PDFMathTranslate 1.9.11 image (pinned by digest) with its Gradio web UI, behind a login. The username is `admin`, and the password is generated at deploy time: open the service's Variables tab and copy `WEB_PASSWORD`. A Railway volume at `/data` keeps saved settings, API keys you enter in the UI, the translation cache and recent files, so a redeploy or restart loses nothing. The document-layout model and fonts are baked into the image, so nothing is downloaded at runtime. Translation runs on CPU, since Railway has no GPU. Give the service 1 GB of RAM (Hobby plan or higher): it starts and serves the UI in 0.5 GB, but layout detection during a translation needs more.

## Common Use Cases

* Read English research papers in Chinese, Japanese, German, French and more, with the math intact
* Share bilingual PDFs of papers and technical documents with a team
* Translate PDFs with your own OpenAI, DeepSeek, Gemini, Ollama or other LLM key for better quality

## Dependencies for PDFMathTranslate Hosting

* PDFMathTranslate 1.9.11 (official `byaidu/pdf2zh` image, built from our GitHub repo)
* A Railway volume for settings, cache and files

### Deployment Dependencies

* Source and update notes: https://github.com/aalfath/pdfmathtranslate-railway-template
* Upstream project: https://github.com/PDFMathTranslate/PDFMathTranslate

### Implementation Details

One service, `pdfmathtranslate`, serves the web UI on Railway's public domain. After deploy:

1. Open the public URL and sign in as `admin` with the `WEB_PASSWORD` value from the Variables tab.
2. Upload a PDF, pick the languages and press Translate. The Service list starts on Bing, which needs no key. Google is also listed, but its free endpoint often answers 429 to cloud servers such as Railway, and the translation then stalls; use Bing or an API key instead.
3. To use an LLM, pick it in the Service list and enter its API key in the UI (it is saved on the volume), or set it as a service variable, for example `OPENAI_API_KEY`, `OPENAI_BASE_URL` and `OPENAI_MODEL` for any OpenAI-compatible API.

Variables: `WEB_PASSWORD` (generated login password), `WEB_USERNAME` (default `admin`), `PDF2ZH_DEFAULT_SERVICE` (service preselected in the UI, default `Bing`), `PDF2ZH_KEEP_DAYS` (days to keep uploaded and translated files, default 7). Change the password by editing `WEB_PASSWORD` and redeploying.

RAM: tested on Railway, a 3-page arXiv paper took 91 s and peaked at about 650 MB with a 1 GB limit. With a 0.5 GB limit (Free plan) the UI runs, but translations, even of one page, can be stopped for lack of memory; the service then exits non-zero and Railway restarts it within seconds. So use 1 GB to translate. Updates: when we bump the version in the template's GitHub repo, Railway shows an update notice in your project; read the repo's CHANGELOG.md, then apply it.

## Why Deploy PDFMathTranslate on Railway?


Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying PDFMathTranslate on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.



## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/pdfmathtranslate-1
