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. Left empty it defaults from -src (else eng), and the app then checks the writing system on the page: where the data for it is installed the language is added rather than replaced (rus+eng), and where it is not the page gets no text plates and a line naming the pack to install. Pass this flag and that check never runs
-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.
-reportfalsePack the recent run logs plus an environment summary into an archive for the author, print where it landed, and exit

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.

Sending logs to the author

When a conversion goes wrong, a description from memory is rarely enough to reproduce it. The app keeps its recent run logs on disk - up to 20 runs or 20 MB, oldest trimmed first - so a failure can still be reported an hour later, or after a crash.

Open About the program at the bottom of the settings in the doc-html-ui app. It states the version, the edition (portable or Microsoft Store) and whether the converter engine was found, and it carries one button: Send logs to the author. One press builds a single archive, opens its folder with the file selected, copies its path to the clipboard, and opens a pre-addressed message in your own mail program. On the command line, -report builds the same archive and prints where it landed.

The archive is written to %LOCALAPPDATA%\doc-html-translate\reports\ and contains exactly three things:

Everything in it is redacted first: anything shaped like a key, token, password or Google API key becomes <redacted>, and your own folders collapse to %USERPROFILE% and %LOCALAPPDATA%. Document file names are kept on purpose - a log that cannot be matched to a document usually cannot be acted on. Your Google API key is never in the archive; an automated test fails the build if it could be. The archive is capped at 15 MB, dropping the oldest logs first and telling you how many were left out.

Nothing is ever sent automatically. The app opens no network connection for this; it hands you a file and an unsent message, you attach the archive and press Send. Use Open the archive in the same section to look inside first, and Clear stored logs if you would rather keep no run history on disk at all.

The browser extension has no log store to archive, so it offers the equivalent it can honestly give: a Copy diagnostics button in the About block of its options page. It copies a short English summary - extension version, browser, interface language, your option set, and the format, page count and last error of the most recent document - to the clipboard, ready to paste into a mail. It carries no document text and no list of your sites.

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.