The Translator in Your Pocket: Translate Any PDF Book With Python
PDF Translation Guide
Translate PDF books from English (or any other language) using Python. Step-by-step instructions for iOS, macOS, Android, and Windows.
You have a PDF book in a foreign language, but you keep reaching for the dictionary every few pages. Or maybe there's a book you've wanted to read for years — and it was never translated. That's exactly why I wrote this guide.
The method I describe here is completely free. No app to purchase, no subscription required. Every tool we use is open source and runs on Google's free translation infrastructure. I tested this on my Android device — it worked. I adapted the same approach for all other platforms and tested each one. Windows is included too, so no one gets left behind.
It might look a bit technical, especially if you've never used a command line before. But we go through it step by step, and I explain what each command does. You don't need to understand the code — just copy, paste, and follow along. Pick your platform from the sections below and get started.
iOS — iSH Shell
Translate PDFs on your iPhone using an Alpine Linux environment
iSH Shell is available for free on the App Store.
Search for "iSH Shell" or go directly to:
apps.apple.com → iSH Shell
Open the app — a terminal screen will appear. You're ready to go.
- iSH is based on Alpine Linux — use apk, not apt or pkg
- Because the iPhone uses an ARM processor, iSH emulates x86 — downloads can take a very long time, be patient
- Your book file must be placed in the iSH → root folder inside the Files app
- Keep the filename short and simple — example: book.pdf
- To save in nano: ^ then O → Enter | To exit: ^ then X
Update iSH
Updates the package list and installed packages
Install Python and pip
Installs the Python interpreter and package manager
Verify Python Version
Confirms the installation was successful
Install System Libraries
C libraries required to compile Reportlab and Pillow
Install Python Packages
The three essential libraries for translation
Install Font
DejaVu font for proper character rendering in the output PDF
Create the Translation Script
Reads the PDF, translates it, and saves the result as TXT
Create the PDF Builder Script
Converts the raw translated TXT into a formatted PDF
✓ OUTPUT FILES
macOS — Terminal
Translate PDFs on your Mac using the built-in Terminal app
Terminal comes pre-installed on macOS — nothing to download.
To open: press ⌘ + Space → type "Terminal" → press Enter.
Or: Finder → Applications → Utilities → Terminal.
- Python 3 usually comes pre-installed on macOS — check by running Step 1
- If you get a "python3 not found" error, download Python 3 from python.org
- Place your book on the Desktop with a short, simple name — example: book.pdf
- Update the INPUT line in the script with your exact filename
- To save in nano: Ctrl + O → Enter | To exit: Ctrl + X
Check Python Version
Verifies that Python is installed
Install Required Libraries
The three essential Python packages for translation
Create the Translation Script
Reads the PDF, translates it, and saves the result as TXT
Create the PDF Builder Script
Converts the raw translated TXT into a formatted PDF
✓ OUTPUT FILES
Android — Termux
Translate PDFs on your Android device using the Termux terminal app
You can get Termux from any of these sources:
🟢 F-Droid (recommended): f-droid.org → Termux
🟡 GitHub: github.com/termux/termux-app
🔴 Play Store: May be an older version — F-Droid is preferred.
Open the app — a terminal screen will appear. You're ready.
- Run termux-setup-storage to grant storage access — without this your PDF won't be accessible
- Place your PDF in the Downloads folder with a short name — example: book.pdf
- Update the INPUT path in the script to match your actual file location
- If curl is missing: pkg install curl
- To save in nano: Ctrl + O → Enter | To exit: Ctrl + X
Update Termux
Updates package list and installed packages
Grant Storage Permission
Required for Termux to access your phone's files
Install Python
Installs the Python interpreter
Verify Python Version
Confirms the installation was successful
Install Required Libraries
The three essential Python packages for translation
Download Font
DejaVu font for proper character rendering in the output PDF
pkg install curl first.Create the Translation Script
Reads the PDF, translates it, and saves the result as TXT
Create the PDF Builder Script
Converts the raw translated TXT into a formatted PDF
✓ OUTPUT FILES
Windows — PowerShell & Notepad
Translate PDFs on Windows using PowerShell and Notepad
PowerShell comes pre-installed on Windows 10 and 11 — nothing to download.
To open: type "PowerShell" in the Start menu → right-click → Run as Administrator.
Or press Windows + X → select Windows PowerShell (Admin).
- During Python installation, check "Add Python to PATH" — if skipped, the python command won't work
- Place your book on the Desktop with a short, simple name — example: book.pdf
- Avoid spaces or special characters in the file path — they can cause errors
- We'll use Notepad to create the scripts — saving instructions are below
- Arial is pre-installed on Windows and supports a wide range of characters — no font download needed
Download and Install Python
Python must be installed separately on Windows
Go to python.org/downloads/windows.
Click Download Python 3.x.x → run the downloaded .exe file.
⚠ On the installer screen, check "Add Python to PATH" at the bottom before clicking Install Now.
Verify Python Version
Open PowerShell as Administrator and run this
Install Required Libraries
The three essential Python packages for translation
Create the Translation Script
Use Notepad to create translate.py
1. Open Notepad from the Start menu
2. Copy and paste the code below
3. Click File → Save As
4. Change file type to "All Files (*.*)"
5. Set filename to translate.py
6. Choose Desktop as location → Save
Create the PDF Builder Script
Converts the raw translated TXT into a formatted PDF
1. Open a new Notepad window
2. Copy and paste the code below
3. Click File → Save As
4. Change file type to "All Files (*.*)"
5. Set filename to make_pdf.py
6. Choose Desktop as location → Save

Comments
Post a Comment