How PDF to EPUB conversion works in epubwise

epubwise converts a PDF to EPUB in six steps: it reads each page's layout, removes what repeats, measures the type, lays out columns and tables, joins the text, and builds chapters.

Most converters treat a PDF as a pile of text lines. This one looks at where everything sits on the page first, then rebuilds the book from that.

  1. Reading every page

    Each page's text is read with its position, size and style. If a page has no real text (a scan) or its text is broken (fonts that map to nonsense characters), that page is read with OCR instead. Scans whose hidden text layer is scrambled are put back in reading order before anything else happens; the scanned PDF guide covers this in more depth.

  2. Finding what repeats

    Running heads, footers and page numbers repeat in the same place page after page. They are removed from the text, and each printed page number is kept as an invisible page marker.

  3. Measuring the book

    The size of the body text is measured across the whole book. Lines that are meaningfully bigger, or bold and on their own, become headings, ranked by size into heading levels.

  4. Laying out each page

    Columns are found from the gap between them, or from where their lines start when the gap is too thin to see, and each is read to its foot before the next. Figures are kept as images with their captions. Tables become real tables, including tables whose rules exist only in a scan's picture, when their columns and rows line up. Maps and charts are kept as pictures of that area. Shaded boxes, verse, code and footnotes are kept apart from the running text.

  5. Joining the text

    Lines become paragraphs from indents, gaps and short last lines. Paragraphs are joined across columns and pages. Words split by a line-end hyphen are rejoined, using the book's own vocabulary to keep real compounds like "long-term".

  6. Building the EPUB

    Chapters come from the PDF's bookmarks, or its headings, or fixed page ranges as a last resort. You get a nested contents list, a page list, and plain styling that your reading app can override, which is what turns a PDF into a proper ebook.

See it on your own file: try the converter with any PDF.