doc-html-translate Documentation

Fast local book reading with free Chrome translation

Convert EPUB/PDF and other formats into local HTML pages, then read in Chrome and translate to your language using built-in browser translation.

Recommended Workflow (Free)

Most convenient everyday scenario:

  • Open the file with the app or run the plain command
  • Open generated index in Chrome
  • Use Chrome page translation to your target language
doc-html-translate.exe "book.epub" # or # doc-html-translate.exe "book.pdf"

Why: no API key setup, no paid translation calls, very fast startup.

Quick Start

Build

go build -o build/doc-html-translate.exe ./cmd/doc-html-translate

Run

doc-html-translate.exe "book.epub" doc-html-translate.exe -notranslate "book.epub" # explicit convert-only doc-html-translate.exe -src en -dst ru "book.epub" doc-html-translate.exe -google "book.epub" doc-html-translate.exe -ollama "book.epub"

Supported Formats

EPUB, PDF, TXT, Markdown, FB2, RTF, HTML, MOBI, AZW3.

MOBI and AZW3: requires Calibre installed. DRM-protected files are not supported.

Optional External Tools

The app works out of the box for EPUB, TXT, FB2, RTF, HTML, Markdown. Install these tools to get full PDF image support and additional formats.

ToolPurposeNeeded forHow to install
pdftotext
(Xpdf / Poppler)
High-quality PDF text extraction — handles complex fonts, ligatures, multi-column layout better than the built-in library PDF files — optional, built-in fallback used when absent xpdfreader.com → "Xpdf tools"
or already included in Git for Windows
ffmpeg Converts JPEG 2000 images (.jpx) extracted from PDFs into JPEG — browsers do not support JPEG 2000 natively PDF files that contain JPEG2000-encoded images (common in commercial PDFs) gyan.dev/ffmpeg → "release essentials"
or winget install ffmpeg
Calibre Converts MOBI / AZW3 to EPUB before processing Required for MOBI and AZW3 format support calibre-ebook.com

Without pdftotext: built-in Go PDF reader is used (slightly lower quality). Without ffmpeg: JPEG2000 images in PDFs will not be visible in the browser. Without Calibre: MOBI/AZW3 files cannot be opened.

Main Flags

Flag Default Description
-notranslatefalseConvert only, skip translation
-noopenfalseDo not auto-open browser
-googlefalseGoogle Cloud Translation API
-ollamafalseLocal Ollama translation
-split5000Split pages at N chars, 0 disables split
-folderemptyCustom output parent folder
-srcenSource language
-dstruTarget language
-forcefalseRebuild even if output exists

Project Links