Dev.to WebDev 🛠 Dev 👁 0 📖 3 min read

How I built a private EPUB to PDF converter that never uploads your book

The problem: printing an EPUB is harder than it should be I come from book marketing, and one request kept coming up: "How do I print this EPUB?" Students get open textbooks as EPUB files. Readers get review copies the

The problem: printing an EPUB is harder than it should be

I come from book marketing, and one request kept coming up: "How do I print this EPUB?" Students get open textbooks as EPUB files. Readers get review copies the same way. Then they need a PDF, because PDF is what printers, office laptops and annotation apps understand.

The usual answers were not great. Calibre works well, but it is a desktop install that many people cannot add to a library or work computer. Most online converters upload your book to their server, convert it there and send it back, often with size limits or a daily cap.

So I built EPUBtoPDF, a free converter that does the whole job inside the browser tab. Your book never leaves your device.

Why convert in the browser

A reading list says a lot about a person: their health questions, their politics, the manuscript they have not shown anyone. I did not want to hold anyone's books on a server, so the converter downloads to the browser and runs on the user's own computer or phone.

That choice gave three practical wins:

  • Privacy you can check. Open the Network tab in your browser's developer tools and convert a book. You will see the converter's own scripts load, but no request carries your file anywhere.
  • Nothing to install. It works in Chrome, Edge, Firefox and Safari on Windows, Mac, Linux, iPhone, Android and Chromebook.
  • No server cost per file. That is what lets it stay free, with no signup, no watermark and no daily limit.

How it works

An EPUB is a ZIP package of XHTML pages, CSS, images and metadata. A PDF stores every page as a fixed layout. The converter's job is to read the first and lay it out again as the second, in five steps:

  1. Unpack the .epub file in the browser and read the package metadata (title, author, cover).
  2. Follow the reading order the book declares, chapter by chapter, and read headings, paragraphs, lists, quotes and images.
  3. Lay out fixed pages at the size the reader picked: A4, US Letter, A5 or 6 x 9 in, with their chosen font size and margins.
  4. Rebuild navigation: each chapter starts on a new page, the table of contents becomes PDF bookmarks, and page numbers are added at the bottom.
  5. Write the PDF with real, searchable text and hand it back as a download.

One detail mattered more than I expected: fonts. Books with accents, Greek or Cyrillic showed empty boxes until the converter loaded a Unicode font automatically. In my tests, Moby-Dick (a 1.55 MB EPUB) became a 731-page A5 PDF about 4 seconds after pressing Convert on a laptop.

What carries over, and what does not

Most of the book survives the trip, but not everything. I would rather say so up front:

Part of the book In the PDF
Chapters, headings, bold, italics, lists, quotes Kept
Cover and images Kept; images scaled to fit the page
Table of contents Kept as PDF bookmarks
Title and author Copied into the PDF properties
Tables Simplified: each row becomes a line of text
Links Text kept, no longer clickable
Publisher fonts and colors Replaced by a clean serif font
Chinese, Japanese, Korean, Arabic Not supported yet
DRM-protected books Not converted, by design

The DRM line is deliberate. Books bought or borrowed through store apps are locked to those apps, and an honest tool should not break that. The converter works with DRM-free files, such as open textbooks and public domain books.

What I learned

  • Most "formatting problems" are page-size problems. An A4 page read on a phone looks tiny. Offering A5 and 6 x 9 in sizes fixed more complaints than any layout tweak.
  • Fixed-layout EPUBs are a different animal. Comics and picture books are rebuilt as flowing text and images, so they are often better left as they are.
  • Be honest about limits. A clear "this book is DRM-protected" message beats a broken PDF.

The same in-browser approach now powers the site's other converters too, including PDF to EPUB, MOBI to PDF, EPUB to Word and AZW3 to EPUB.

If you try EPUBtoPDF with your own books, I would like to hear two things in the comments: how the PDF layout looks, and which ebook format or feature you would want next.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.