EPUB to PDF

Published Updated

Join the chapters of an EPUB into one document and save it as a PDF from the print dialog.

How the book is put together

An EPUB is a ZIP of XHTML files, and the converter follows the same steps a reading app does, in a simpler way.

  • It reads META-INF/container.xml to find the package file, then the title, author and cover.
  • It follows the spine, which is the reading order, and takes the body of each file.
  • It embeds images linked with img tags, and images inside inline SVG, as data URLs so they print.
  • It joins the chapters into one document and rewrites the links between them, so a link to another chapter jumps to it.
  • It lists chapter files that are named in the book but missing from the file.
  • It starts the PDF with a title page: cover image, title and author.

The container and the package layout are defined in the EPUB 3.3 specification.

What the print stylesheet decides

AspectWhere it comes from
FontsGeorgia or Times New Roman at line height 1.6
Page breaksAfter every file in the spine
Paper size and marginsYour print dialog
Header and footer textYour browser's print settings
Cover sizeAt most 60% of the width and 400 px high

Page breaks, measured on generated EPUBs

We built small EPUB 3 files with a script (Python's zipfile module, with a Pillow 11.3.0 cover). The text is random words, not a real book. We ran this page's own reader and HTML builder (lib/epubParser.ts) on them, then printed the compiled HTML to PDF with Chromium 153.0.8010.12 (the build that ships with Playwright, headless, not Google Chrome) using Letter paper and 0.5 inch margins, which are our settings and not your print dialog's, and read the PDF back with pdf.js 5.4.624. The reader and builder gave the same results in Chromium 153, Firefox 155.0 and Playwright's WebKit build (user agent Version/26.6, not the Safari app).

Test bookPDF pagesWhat was on them
12 chapters of about 120 words, each in its own file13A title page, then 12 pages with 801 to 822 characters of text each.
The same text in one file7A title page, then 6 pages with 541 to 2,066 characters each.
40 files, each a heading and one 25-word paragraph41A title page, then 40 pages with 170 to 184 characters each, a few lines on a page.

The page break after each file is therefore the biggest effect on the page count. The same 9,800 characters took 13 pages when split into 12 files and 7 when kept in one, and a book of 40 tiny files gave 40 nearly empty pages. The PDFs were 47,421, 43,495 and 67,519 bytes.

What the compiler keeps from a chapter

A second generated book had a style block and a linked stylesheet, a class on a heading, an inline style and images. A third generated book had images inside SVG wrappers, links between chapters, the same id in two chapters, an SVG gradient, a spine entry whose file is missing and a spine entry with no file entry. We ran the parser and compiler in Chromium 153, Firefox 155 and the WebKit build, and printed the result with Chromium 153 only. The results were the same in all three engines.

In the EPUBIn the compiled document
A style block in the chapter's head, and a linked CSS file (a red monospace heading, an italic indented poem, a table border)Not applied. The heading came out in the page's own dark grey and serif font, the poem was upright with no indent, and the table border was 0 px.
An inline style attribute on a paragraph (blue text)Kept. The paragraph was still blue.
An img tag with a relative path, and the cover imageBoth were embedded as data URLs.
An img tag with an https addressLeft as the web address, so it prints only if the address is reachable.
An image inside an inline SVGEmbedded as a data URL, for both the href and the xlink:href spelling. In all three engines the image drew at its set size of 200 x 150 pixels.
A link to another chapter fileRewritten to point at the chapter or the id inside it. Ids are prefixed per chapter, so two chapters that both use id note do not clash. In the PDF printed by Chromium 153, the link annotations jumped to page 5 and page 7, the pages where those chapters start. A link to a file that is not in the book is left unchanged and does not work.
A spine entry whose file is missing from the ZIPLeft out, and the page shows a note naming the missing file. The other chapters are converted.
An EPUB without META-INF/container.xmlThe reader raised the error Missing "META-INF/container.xml" in EPUB package, and the page shows "Couldn't read this EPUB file".

Making a PDF from an EPUB

  1. Step 1

    Add an EPUB

    Pick one .epub file. The page reads its cover, title, author and list of chapters.

  2. Step 2

    Press Convert EPUB to PDF

    The chapters are joined into one document and your browser's print dialog opens.

  3. Step 3

    Save as PDF

    Choose Save as PDF as the printer, set paper size and margins, and save. If you close the dialog, Save / Print PDF opens it again.

Where the result falls short

Comics, picture books and other fixed-layout EPUBs depend on exact positioning, which this tool does not keep. Books that rely on their own CSS for poems, tables or sidebars lose that styling. If you only want to read the book on a phone or tablet, the EPUB is the better file to keep. The browser's print function is what produces the PDF.

EPUB to PDF FAQ

Why are my EPUB's fonts and layout not kept?

Only the content of each chapter's body is used. The book's own stylesheet and embedded fonts are left out, and a fixed serif style (Georgia or Times, with generous line spacing) is applied instead.

Why do I get a print window and no download?

The tool has no PDF writer of its own. It prepares one HTML document and uses the browser's print function, so the PDF comes from your browser's Save as PDF option.

Will there be a table of contents in the PDF?

The tool lists the chapters it found on the page, but it does not add a contents page to the PDF. A title page with the cover, title and author comes first.

Are images included?

Images used through img tags, and images inside an SVG wrapper (an image element with an href or xlink:href), are embedded when the file is stored inside the EPUB. Images fetched from a web address are not embedded, so they print only if the address is reachable.

Does it work on DRM-protected books?

No. Protected books are encrypted, so the chapter files cannot be read. Only plain EPUB files work.

Why does every chapter start on a new page?

Each file in the book's reading order is wrapped in a section with a page break after it. A book that splits into 40 files gets 40 forced breaks, and short files leave half-empty pages.

Why did my 12-chapter book become 13 pages?

Each file in the book's reading order ends with a page break, and the tool adds a title page. In our test, 12 one-page chapters in 12 files printed as 13 pages, and the same text in one file printed as 7.

Do the links between chapters work in the PDF?

Yes, for links to chapters that are in the book. A link to another chapter file, with or without a #fragment, points at that chapter or at the element with that id in the compiled document, and links inside one chapter keep working. Chromium 153 printed the compiled book to a PDF whose link annotations jumped to the right pages, as read back with pdf.js. A link to a file that is not in the book does not work.

What happens to a chapter file that is missing from the EPUB?

The remaining chapters are converted, and the page lists the missing file in a note above the Convert button so you can see that part of the book is absent. The same note appears for a reading-order entry that has no matching file entry.

Related Tools