BookTranslator
BookTranslator

How to Convert a Scanned Book to a Reflowable EPUB

Turn scanned book pages into a searchable, reflowable EPUB with an OCR, structure-recovery, validation, and device-testing workflow.

BookTranslator

BookTranslator Team

10 min read

To convert a scanned book to a reflowable EPUB, do not put the page images into an EPUB container and stop. First create clean page images, run OCR, remove page furniture and recognition errors, reconstruct chapters and paragraphs, then build and validate an EPUB whose text can resize and reflow. Keep the original scan beside the new file: the scan remains the visual record, while the EPUB becomes the readable and searchable edition.

The decisive question is whether you need reflowable text or fixed pages. Reflowable EPUB is the right target for a mostly textual book that should support adjustable type, search, selection, read-aloud, and later translation. Keep a PDF or use a fixed-layout publication when page geometry itself carries the meaning—for example, a facsimile, comic, art book, annotated manuscript, or complex score.

The Scan-to-EPUB Pipeline

Use six separate gates instead of one opaque “convert” button:

  1. establish the exact edition and complete page inventory;
  2. clean and orient the page images;
  3. run OCR with the correct language and layout assumptions;
  4. correct the text and remove page furniture;
  5. reconstruct semantic book structure; and
  6. build, validate, and test the EPUB.

Each gate catches a different failure. A ZIP-valid EPUB can still have missing chapters. Correct OCR can still be arranged in the wrong reading order. A structurally valid EPUB can still contain a repeated running head on every screen.

Choose Reflowable EPUB Only When the Text Can Leave the Page

A scan records appearance. A reflowable EPUB records content and structure. Conversion therefore requires editorial decisions, not only character recognition.

Source featureReflowable treatmentReason to keep the scan or PDF
Ordinary paragraphsReal paragraphs in reading orderPage breaks are historically significant
Chapter headingsSemantic headings and navigation entriesHeading position is part of the facsimile
FootnotesLinked notes with return linksNotes rely on a complex page apparatus
IllustrationsSeparate images with captions and useful alt textImage placement and surrounding typography are inseparable
TablesAccessible HTML tables when they remain understandableThe table is too irregular to reconstruct reliably
MarginaliaTranscription, note, or intentionally omitted material with a recordHandwriting and spatial relationships are the object of study

If you cannot explain how a page feature should behave when the font grows and the screen narrows, you have not yet designed its reflowable equivalent.

A Reproducible Four-Page Conversion Fixture

For this guide, we built a controlled four-page booklet called The Lantern Ledger. Its original text, generator, page images, raw OCR, cleanup log, and final EPUB are dedicated to the public domain under CC0 1.0. The fixture is deliberately small enough to inspect line by line; it is not presented as a historical scan or a general OCR benchmark.

You can inspect the complete fixture directory, reproduce it with the Python generator, compare the cleanup decisions, and download the final EPUB. The final EPUB SHA-256 is 30fa91a163baadf86dcdcc0560b7a0b86350655a0bbaf755d82ab4277817754c.

On September 19, 2026, the fixture ran through Tesseract 5.5.3 with English, LSTM mode (--oem 1), the single-uniform-block assumption (--psm 6), and 300 dpi. We did not retry individual pages or silently exclude an output. The result exposed three problems that an automatic text export did not resolve:

Observed resultRequired decisionWhy a converter cannot safely guess
The running title appeared on all four pagesRemove it from chapter textA repeated line might instead be a meaningful heading
Page 1 was recognized as al; page 3 became 3)Remove page furniture after checking page orderA number in the same position could be a list item or content
A printed line-end hyphen produced line- followed by stoppedRestore the intended sentence rather than join blindlySome hyphens belong to compound words and must remain

The raw page-one OCR and raw page-two OCR make those decisions auditable. We used the known source text—not the OCR output alone—to build the final chapters.

The completed file then passed EPUBCheck 5.4.0 using EPUB 3.4 rules with 0 fatal errors, 0 errors, 0 warnings, and 0 informational messages. The raw validation report is included. That result proves conformance to the rules checked by that validator; it does not prove transcription accuracy, translation quality, accessibility, or rendering in every reading system.

Step 1: Freeze the Edition and Page Inventory

Before OCR, identify the exact copy you are converting. Record:

  • title, author, edition, language, and source;
  • front matter, numbered pages, plates, foldouts, and back matter;
  • missing, duplicated, or out-of-order images;
  • printed page labels versus scan file numbers; and
  • the rights or authorization that permits your intended use.

Create a simple manifest with one row per scan image. Do not rename or discard the original files after OCR. If page 83 is absent from the scan, better recognition settings cannot recover it.

Step 2: Preprocess Without Erasing Evidence

Work on copies. Rotate pages to the correct orientation, crop irrelevant borders, deskew text lines, and correct severe contrast problems. For photographed books, dewarping the curved text block can matter more than sharpening.

Do not apply every cleanup filter by default. Aggressive thresholding can erase punctuation, diacritics, faint notes, or thin type. Keep a before-and-after sample from each page class and verify the changes at full resolution.

OCR quality depends on the page, script, typeface, language model, and segmentation choice. A setting that fits one rectangular paragraph is not automatically appropriate for two columns, side notes, tables, or vertical text.

Step 3: Run OCR and Keep the Raw Output

Tesseract's input-format documentation states that Tesseract reads image formats rather than PDF input directly. Render PDF pages to images first, or use a PDF-aware wrapper. OCRmyPDF's cookbook documents a PDF workflow and sidecar text, but its sidecar is not a substitute for inspecting the final PDF and source pages.

For every run, save:

  • OCR engine and version;
  • exact language models;
  • page-segmentation and preprocessing settings;
  • raw text or structured output;
  • page-image hashes or stable filenames; and
  • retries, exclusions, and manual corrections.

Plain text is useful for review, but structured OCR such as hOCR, ALTO XML, or PAGE XML can retain coordinates and regions needed to reconstruct columns, notes, and reading order. Choose the output based on what the book contains.

Step 4: Correct Text Before You Build Chapters

Review the OCR against the page images. Do not wait until after translation, because translation will make source recognition errors harder to diagnose.

Use a two-level pass:

  1. Mechanical cleanup: repeated running heads, page numbers, line-wrap artifacts, obvious OCR substitutions, and accidental blank lines.
  2. Editorial reconstruction: paragraph boundaries, headings, footnotes, captions, scene breaks, lists, tables, and intentional spelling.

Track corrections by page. A useful row records the page-image filename, raw OCR span, corrected text, error class, and reviewer. For long books, sample every distinct page class and then search the complete OCR for the discovered error patterns.

Never join every line-ending hyphen automatically. Compare the word with the source image and language. inter- plus national may be a broken word, while well- plus known may require the hyphen. The same caution applies to ligatures, historical spelling, abbreviations, and normalized punctuation.

Step 5: Reconstruct Book Structure, Not Page Layout

The corrected text still needs a book model. Build an explicit chapter inventory and map each entry to:

  • one content document or intentional section;
  • one position in the reading order;
  • one navigation label and target;
  • its notes, images, captions, and internal links; and
  • its source page range for audit.

The EPUB 3.4 specification defines an EPUB publication as a package with declared resources, a spine for default reading order, and a navigation document. A folder of page images or unrelated HTML files does not supply that structure merely because it has an .epub extension.

For prose, use real headings and paragraphs. Do not preserve page breaks with fixed heights or repeated empty lines. Keep print page references only when readers need them, and represent them consistently rather than leaving OCR page numbers inside sentences.

Step 6: Add Metadata and Build the EPUB

At minimum, set the exact title, identifier, content language, and modified date required by the EPUB package. Add creator and rights information when applicable. Include only referenced resources, and make filenames and identifiers stable.

Then build the archive with the required uncompressed mimetype entry first, followed by its container and publication resources. A general-purpose ZIP command can create an archive that opens in a tolerant reader but violates EPUB packaging requirements.

Use EPUBCheck on the exact candidate you intend to distribute. Fix errors; review warnings and usage messages in context. Save the validator version, raw report, and final file hash together. If the EPUB changes, rerun the check.

Step 7: Test Reading Behavior, Not Only Conformance

Open the exact final file in the reading systems that matter. At minimum:

  • use the contents menu to reach the first, middle, and last chapters;
  • change font size, line spacing, margins, and screen width;
  • search for a known phrase near the beginning and end;
  • select and copy text with punctuation and diacritics;
  • test notes, backlinks, images, captions, and internal links;
  • check language metadata and read-aloud behavior where required; and
  • compare a sample from every page class against the original scan.

The translated EPUB QA checklist separates package, content, navigation, typography, image, and accessibility checks. The cross-reader test matrix covers the difference between validation and device or retailer behavior.

When Translation Is the Next Step

Convert first when the scan is the only source and a clean, reflowable edition does not exist. Translation should receive the corrected EPUB, not raw OCR or a folder of page images. That gives the translation workflow stable chapter boundaries, explicit reading order, searchable text, and navigation that can be checked again afterward.

If you only need a translated reading copy and preserving the scan's visual organization matters more than reflow, use an OCR-first scanned PDF workflow instead. If you need adjustable text and an ebook output, build and validate the source EPUB, then use the EPUB translator and repeat the structural and language review on the translated file.

Translation cannot repair a missing page, an invented paragraph boundary, or a caption attached to the wrong image. It can only transform the source structure you give it.

Release Gate

Do not release the converted EPUB until all of these are true:

  • the source edition and rights basis are recorded;
  • every intended page is present exactly once;
  • OCR settings and raw outputs are preserved;
  • recurring OCR and layout errors have a documented treatment;
  • chapter, paragraph, note, image, and caption structure is explicit;
  • the spine and contents menu match the intended reading order;
  • metadata describes the correct edition and language;
  • EPUBCheck has no unresolved release-blocking findings;
  • the final hash identifies the file that was actually tested; and
  • representative passages match the original scan in a real reader.

A scan-to-EPUB conversion is complete when the result behaves like a book rather than a pile of photographed pages—and when a later editor can trace every important decision back to the source.

Related Posts