Skip to content
epub2pdf Convert

How it works

All of this happens in your browser, in a background thread, on bytes read straight off your own disk. There is no server in the path because there is no server at all.

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.

The hard part is not reading the book

An EPUB tells you everything about its structure and nothing about its pages, because it has none. Every line break and every page break in the finished PDF is a decision that did not exist a moment earlier. That is the work: not extraction, but typesetting.

It is the exact inverse of the sibling site to this one, which converts PDFs into ebooks. That job is archaeology: a PDF records where each character sits and nothing about what it means, so paragraphs and chapters have to be reconstructed from geometry. Here the meaning arrives intact and the geometry has to be invented.

The pipeline

  1. 01

    Opening the container

    An EPUB is a zip. We unpack it in memory, read META-INF/container.xml to find the package file, and read that for the metadata, the manifest of every file inside, and the spine, which is the reading order. Unlike a PDF, none of this has to be guessed: it is all declared.

  2. 02

    Reading the chapters

    Each spine document is parsed as XHTML, falling back to an HTML parser when it is not well-formed. A great many published EPUBs are not, usually over a bare ampersand or an unclosed tag, and losing a chapter to someone else's typo is not an acceptable outcome.

  3. 03

    Reading the structure, ignoring the style

    We take the semantics (heading, emphasis, list, quotation, figure) and drop the book's stylesheet. Honouring EPUB CSS properly would mean a layout engine the size of a browser's, and the answer would still be wrong: that CSS was written for a page whose size the reader picks at run time, and ours is fixed.

  4. 04

    Making the text drawable

    The standard PDF fonts speak WinAnsi, which is Latin-1 plus a few dozen typographic characters. Ligatures are decomposed, the several widths of space become spaces, soft hyphens are dropped, and anything genuinely outside the repertoire is counted so you can be warned before you commit rather than after.

  5. 05

    Breaking lines

    Each paragraph is broken greedily against the real font metrics: take words until the next one will not fit, then start a line. If justification is on, the line is pushed out to the margin by widening its spaces, unless doing so would take more than half the line. Past that point a river of white space looks far worse than an uneven edge.

  6. 06

    Breaking pages

    The cursor runs down from the top margin until something will not fit. A heading is never left at the foot of a page without at least two lines of what it introduces. A paragraph is only split if both halves keep two lines, so no line is ever stranded alone. A figure that will not fit moves to the next page rather than being cut in half.

  7. 07

    Writing the PDF

    Pages are drawn, the cover goes in front, and the contents page is written once the page numbers are known, each entry a real number and a link that jumps there. The PDF outline is built by hand, since pdf-lib has no API for it, and the running heads and page numbers go into the margins.

Why the fonts are the ones already on your machine

Every PDF reader has Times, Helvetica and Courier built in, and we use those rather than embedding anything. Three things follow. Nothing has to be downloaded for the converter to run, so it works with the network unplugged. The output PDF is usually smaller than the EPUB that produced it, because it carries no font data at all. And the character repertoire is limited to WinAnsi, meaning Latin and its accents, which is why non-Latin scripts are the one limitation below that no option can work around.

What it gets wrong

Ordinary prose converts well: novels, essays, reports, manuals. Everything below is a real limitation rather than a bug, and most of them are trades made on purpose.

DRM-protected books
Encrypted, so there is nothing to read. We detect it and say so. We do not remove DRM, and that is not going to change.
Non-Latin scripts
Greek, Cyrillic, Hebrew, Arabic and CJK are not in the standard PDF fonts. Latin and its accents are, which covers most European languages. You are warned before converting.
Tables
Flattened to their cells' text, one row per line. Real column widths would have to be negotiated against content never measured for your page, and a table that silently overflows the margin is worse than one that reads as a list.
Footnotes
Rendered inline where the markup put them, rather than collected at the foot of the page. Doing it properly means laying out a page, discovering which notes it needs, and laying it out again.
Fixed-layout books
Comics and picture books are already pictures. You get the pictures. None of the text options do anything, because there is no text.
Hyphenation
Not done. It needs a dictionary per language, and without it justified text in a narrow column occasionally has visibly loose spacing. Turning justification off is the fix.
The book's own fonts and colours
Replaced with ours. See the third stage above; this is the trade the whole tool rests on.

Try it on something

Free, in your browser, and the book never leaves your device.

Open the converter