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. No API key, no subscription, no ceremony required.

Editions - all the ways to use it

Doc-HTML-Translate comes in several forms; they share the same converter and the same "hand the browser clean HTML, let it translate" idea. Pick whichever fits.

Recommended Workflow (Free)

The most convenient everyday scenario, and yes, "free" really does mean free:

  • 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, and CBZ/CBR/CB7/CBT comics. A reasonable spread, if we say so ourselves.

Also comic archives (CBZ / CBR / CB7 / CBT): a container of page images with no text layer, opened page by page with OCR forced on, so the speech-bubble text is recognized and laid over each page as translatable plates. CBZ and CBT need nothing extra; CBR and CB7 require 7-Zip installed (the same external-tool pattern as MOBI needing Calibre).

Also a standalone image (PNG, JPG, JPEG, WebP, GIF, BMP, TIFF): the app OCRs it and lays translatable text plates over the picture, so Chrome/Edge page translation works on it in place - the same overlay the browser extension produces. Needs the Tesseract OCR engine (see -ocr-lang).

MOBI and AZW3: requires Calibre installed. CBR and CB7 comics: require 7-Zip installed (CBZ and CBT need nothing extra). DRM-protected files are not supported - the converter respects locks it cannot pick.

Plain-text (.txt) input is decoded by sniffing its bytes - a UTF-8/UTF-16 byte-order mark, then valid UTF-8, then a legacy Cyrillic code page (Windows-1251, KOI8-R, CP866) by detection - so a DOS-era or Notepad "Unicode" .txt reads as text, not mojibake. An unreadable binary (a .docx, .djvu, or a comic archive with no 7-Zip) is refused with a named format instead of being turned into a garbage document.

Reading Experience

The generated HTML carries a small, fully client-side reader layer - no server to babysit, works happily on file://:

Single-page documents have no navbar and therefore no reader layer.

Optional External Tools

The app works out of the box for EPUB, TXT, FB2, RTF, HTML, Markdown. The tools below are strictly optional - install them only if you want full PDF image support and the extra 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 still politely refuse to display JPEG 2000 in 2026 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
7-Zip Unpacks CBR (RAR) and CB7 (7z) comic archives into their page images CBR and CB7 comics - CBZ and CBT need nothing extra 7-zip.org

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. Without 7-Zip: CBR/CB7 comics cannot be opened.

Main Flags

All optional. The defaults are sensible, so you can ignore this whole table until you have an opinion.

Flag Default Description
-notranslatefalseConvert only, skip translation
-noopenfalseDo not auto-open browser
-googlefalseGoogle Cloud Translation API
-ollamafalseLocal Ollama translation
-ocrfalseOCR text inside document images and overlay it as translatable HTML (needs Tesseract)
-ocr-lang(-src)OCR language(s), e.g. eng or eng+rus (defaults from -src, else eng)
-ocr-langsfalseList installed/available OCR languages and exit
-ocr-downloademptyDownload an OCR language pack (e.g. -ocr-download rus) and exit
-max-cost0Abort paid translation before sending if the estimated cost in USD exceeds N. When in doubt, 0 (no limit) is a perfectly respectable choice
-split5000Split pages at N chars, 0 disables split
-toc-depth0Table-of-contents nesting depth on index.html, 0 = unlimited, 1 = chapters only
-folderemptyCustom output parent folder
-srcenSource language
-dstruTarget language
-ui-lang(system)Interface language: en ru uk de it es fr pt ar hi bn ur zh. Empty follows the Windows language
-forcefalseRebuild even if output exists
-registerfalseOpt in to becoming the default handler for EPUB, PDF and other supported files (off by default; also the default-handler toggle in the doc-html-ui app). The first run only adds the right-click entry and offers this.
-unregisterfalseRelease the default-handler association (keeps the "Convert to HTML" right-click entry and "Open with").
-register-openwithfalseAdd the app to the Windows "Open with" list and the "Convert to HTML" right-click menu, without making it the default handler. The doc-html-ui app does this automatically on launch, so the app is always reachable even if you never set it as default.

Every option above is also available in the doc-html-ui graphical app - file picker, drag & drop, TOC depth, spending guard and a default-handler toggle (opt-in, off by default; the app always adds the "Convert to HTML" right-click entry). On the Microsoft Store build the GUI is the launchable entry point, while double-clicking a file still runs the command-line converter.

Companion App: FastMediaSorter LITE

For documents that are pictures, not text - screenshots, manga, photographed or scanned pages, the things a text converter cannot read your mind about - use FastMediaSorter LITE, a free Windows app for opening and sorting images and videos with built-in OCR + on-image translation. Press T on any image to recognize the text and overlay the translation in your language (local Ollama or LibreTranslate). It complements Doc-HTML-Translate, which targets ebook and text formats.

winget install SerZhyAle.FastMediaSorter

Project Links

Interface languages

The interface of the application and the extension is available in 13 languages: en ru uk de it es fr pt ar hi bn ur zh. English, Russian and Ukrainian are author-proofread; the other ten are machine-translated and unproofread - corrections are welcome at sza@ukr.net.