How it works
Converting a PDF to an ebook isn't a translation between formats. It's a reconstruction, and a fair bit of it is guesswork. Here's what gets guessed, so you know what to expect and where it'll let you down.
Nothing leaves your device
No upload endpoint, no storage bucket, no accounts. The converter is JavaScript running in your browser. Open the network tab and watch it stay silent while the thing works.
-
01
Reading the page
pdf.js parses the document and hands back every run of text with its position, size and font. That really is all a PDF contains. There are no paragraphs in there, just characters at coordinates.
-
02
Finding lines
Runs that share a baseline get merged into a line, with spaces added wherever the gap is wider than the font would naturally leave. If a page has a clear blank corridor down the middle, we treat it as two columns and read the left one first, so academic papers don't come out interleaved.
-
03
Finding paragraphs
Lines keep joining onto a paragraph until something says stop: a bigger-than-usual gap, an indent, a change of font size, or a short line ending in a full stop. Words hyphenated across a line break get put back together.
-
04
Removing the furniture
Text that shows up in the top or bottom margin on a third of the pages is a running head or foot. A lone number in the same spot is a page number. Both get dropped. In a reflowable book they'd otherwise interrupt you every few screens.
-
05
Finding chapters
If the PDF has bookmarks we use those, since they're the author's own structure. If it doesn't, we look for headings by relative font size. Very long chapters get split so no single file bogs your reader down.
-
06
Lifting the pictures
Images turn up in the page's drawing instructions rather than its text. We replay those instructions and track the transform in force when each picture is painted, which is what tells us where it sat. Logos and watermarks that appear on most pages get binned, as do images too small to be figures.
-
07
Writing the EPUB
Chapters become XHTML, images get embedded, and the table of contents is written twice: the EPUB 3 way and the older NCX way, because Amazon still reads the old one. Page one gets rendered as a cover so the book has a thumbnail.
Where it struggles
More useful than a list of features. If your document is in this table, brace yourself.
- Scanned documents
- Nothing to extract. Run it through OCR first, which we don't do.
- Complex tables
- A reflowable format has no real page, so wide tables get flattened into a list and often read badly.
- Maths and formulae
- Equations built from positioned characters lose their layout. Equations saved as images survive as images.
- Magazines and heavy design
- Pull quotes, sidebars, text wrapping round pictures: none of it survives. With those layouts there often isn't one correct reading order to find.
- Right-to-left scripts
- We assume left-to-right when assembling lines, so Arabic and Hebrew come out scrambled.