PDF to EPUB

Published Updated

Turn the text of a PDF into an EPUB 2 e-book with one chapter per page and a title and author that you choose.

Text only, one chapter per page

This converter extracts the text of each PDF page and wraps it in plain XHTML. The EPUB that comes out has no images, no fonts and no page layout. Its pages are chapters, so on an e-reader it behaves like a long list of short sections that you can resize and re-flow.

That suits a text-heavy PDF such as a report, an article or a novel exported from a word processor. It does not suit a textbook, a magazine, a form or anything where position on the page carries meaning.

What is inside the file

An EPUB is a ZIP archive. This tool writes the older EPUB 2.0 layout, not the EPUB 3.3 that the W3C now publishes.

PartContent
mimetypeapplication/epub+zip, stored first and uncompressed
META-INF/container.xmlPoints to OEBPS/content.opf
OEBPS/content.opfTitle, author, language fixed to English, one manifest item and spine entry per page
OEBPS/toc.ncxThe navigation list: Page 1 to Page N
OEBPS/chapterN.xhtmlOne file per PDF page, holding its headings, paragraphs and lists

The navigation file and package layout follow the IDPF OPF 2.0.1 specification. Because the language is always set to English, add the right language in a tool such as Calibre if your reader depends on it.

Making an EPUB from a PDF

  1. Step 1

    Add a PDF

    Pick one PDF with a text layer. Password-protected files are rejected with a message to remove the password first.

  2. Step 2

    Set the title and author

    The title starts as the file name and the author as GoConvertFiles. Replace both before converting.

  3. Step 3

    Convert and download

    The result card gives the page count and file size. Open the EPUB in your reading app to check it.

Better options for some PDFs

If the output does not read well, try one of these before you give up:

  • A locked PDF: open it with Unlock PDF first.
  • Plain text you want to proofread: PDF to Text gives a .txt.
  • Images matter: keep the PDF, or use a fixed-layout EPUB made in a desktop tool.
  • Going the other way: EPUB to PDF.

Worked example: three generated PDFs

Three PDFs were generated by script: one has 30 pages of plain text lines (31,487 bytes), one has 4 pages that are only JPEG images (1,797,165 bytes), and one is a one-page layout test. The site's own text extractor and EPUB builder were bundled and run in Google Chrome 158. Each EPUB was then opened as a ZIP and read entry by entry. Sizes change by a few bytes from run to run, because each book gets a random ID.

PDFEPUB sizeWhat came out
30 pages of text, 31,487 Babout 20.5 KB30 chapters, one per page, 34 ZIP entries, mimetype first and stored
4 image-only pages, 1,797,165 Babout 2.6 KB4 chapters, each an empty paragraph; no text was found

In the file, the first entry was the mimetype, stored without compression, and the other entries were compressed. The language field read en and the author field read GoConvertFiles. In the one-page layout test, the text Café with its accent, 5 < 6 and 7 > 3 came through, with the symbols escaped in the XHTML. The Library of Congress gives byte offsets near the start of the file for the mimetype signature (30 and 38), which is consistent with the entry coming first (Library of Congress, EPUB), and the W3C lists the language element among the required package metadata (EPUB 3.3).

How the structure is guessed

The extractor reads line positions and sizes. A line at least 15 percent larger than the page's body size, and at most 3 lines and 200 characters long, becomes a heading, with the largest size as the top level. A line that starts with a bullet character or with "- " or "* " becomes a list item, and layout gaps split paragraphs. Bold headings in body size and tables stay paragraphs. Lines numbered in a run of at least two, such as 1, 2, 3, become a numbered list. A run that starts above 1, such as 5, 6, 7, keeps its numbers as numbered paragraphs instead.

In Chrome 158, a generated one-page PDF with two heading sizes, two paragraphs, three bullet lines and two numbered lines gave an EPUB with 2 headings, 2 paragraphs and 5 list items. A PDF with three paragraphs separated by line gaps gave three paragraphs, and the rows of a small table came out as one paragraph. An image-only PDF gives a book of empty pages. The tool does not read text from pictures, so a scan has to be run through OCR first.

PDF to EPUB FAQ

Why does my e-reader show GoConvertFiles as the author?

That is the default in the Author box. Type the real name before you press Convert to EPUB, because the value is written into the book's metadata and cannot be edited afterward on this page.

Why does the book have one chapter per PDF page?

The converter creates one XHTML file for each PDF page and lists them as Page 1, Page 2 and so on in the table of contents. It does not try to find real chapters. A sentence that runs across a page break is split between two files.

Why do some pages come out as one long paragraph?

Paragraph breaks come from the layout: a line gap wider than the page's normal line spacing, a change of text size, or a jump back up the page. Lines set with even spacing have no gap to find, so they are joined into one paragraph. In a generated PDF with three paragraphs separated by gaps, the EPUB had three paragraphs. Page numbers and running headers stay in the text.

Will images, tables and columns come along?

No. Only text is carried over, in the order the PDF reader finds it. Images are dropped, table rows run together as text, and multi-column layouts can read in a different order than on paper.

What does the warning about text near a page edge mean?

The PDF reader used here, pdf.js, can silently drop characters from a line that runs right to the page edge. When any line on any page does, the result card shows an amber warning, and you should compare that page with the PDF.

Will a scanned PDF work?

No. A scan is a picture with no text layer, so every chapter comes out empty. Run it through an OCR program first.

How big will the EPUB be compared with my PDF?

Smaller for text, tiny for scans. In our test a 31,487 B text PDF with 30 pages became an EPUB of about 20.5 KB, and a 1.8 MB image-only PDF became one of about 2.6 KB with nothing in it.

Will headings and bullet lists keep their shape?

Partly. The tool guesses from text size and position: lines clearly larger than the page's body text become headings, lines that start with a bullet character or a dash become list items, and gaps in the layout split paragraphs. Bold headings in body size and tables stay paragraphs, and lines numbered in a run such as 1, 2, 3 become a numbered list (a run that starts above 1 keeps its numbers as numbered paragraphs).

Why are my chapters empty?

The PDF has no text to extract, which is the case for scans and photos of pages.

Related Tools