Why does my EPUB show page numbers in the middle of the text?
Updated:
Your EPUB shows page numbers in the middle of sentences because the converter copied the PDF's page furniture (page numbers, running headers and footers) as if it were part of the text. The fix is a converter that detects text repeated at the top or bottom of the pages and removes it before joining the paragraphs.
Fixed layout vs. reflowable text


Why it happens
In a PDF, the page number and the running header ("Chapter 3", the book title, the author's name) are ordinary text, drawn on the page like everything else. A converter that reads the text in order puts "47 THE TITLE OF THE BOOK" between the last line of one page and the first line of the next, which is often in the middle of a sentence.
How EpubCC removes it
- Short blocks in the top or bottom 12% of the page that repeat on at least 3 pages are treated as margins and removed, with digits and roman numerals normalised so "47" and "48" count as the same header.
- A block that is only a page number is removed too.
- For the free sample, the engine also reads up to 4 neighbouring pages on each side, only to detect headers, because odd and even pages often carry different headers that a 5-page sample would never see repeat.
- After the margins are gone, a paragraph cut by the page break is joined again when the next page continues the sentence.
If you already have the EPUB
You can delete the numbers by hand in an EPUB editor, but on a long book it is faster to convert again from the PDF with a converter that handles margins. The benchmark measures margin leak, the share of repeated headers and page numbers left in the text, for every engine.
Evidence from the benchmark
| Engine | Margin leak |
|---|---|
| EpubCC engine (EPUB output) | 0.071 |
| EpubCC engine (plain text) | 0.988 |
| pdf_oxide · extract_text | 0.887 |
| pdf_oxide · to_plain_text (XY-cut) | 0.794 |
| pdf_oxide · Markdown | 0.102 |
| PDFium · text().all() | 0.999 |
| OpenDataLoader PDF (local mode) | 0.010 |
| pdftotext (Poppler) | 0.046 |
Remove headers and page numbers
Convert up to 5 pages free, no account needed.