EPUB libraries
Open-source libraries that read and write EPUB files. Most EPUB libraries do one of two jobs: parse a book (metadata, table of contents, chapters as XHTML) or build one from HTML pieces. Libraries that render EPUB to pages, text or PDF need a layout engine; MuPDF (and PyMuPDF) is the main open-source option.
| Language | Library | Read | Write | Notes |
|---|---|---|---|---|
| C/C++ | MuPDF | yes | no | lays out and renders EPUB, extracts text, converts to PDF; AGPL |
| C# | VersOne.Epub | yes | no | complete EPUB 2 and 3 reader, public domain |
| C# | QuickEPUB | no | yes | create simple EPUBs from HTML sections |
| Java | epub4j | yes | yes | maintained fork of epublib, works on Android |
| Go | go-epub | no | yes | creates valid EPUB 3 files |
| Go | goreader/epub | yes | no | minimal reader: metadata, manifest, spine |
| Python | EbookLib | yes | yes | the standard Python EPUB library; AGPL |
| Python | PyMuPDF | yes | no | text extraction, rendering, convert to PDF; AGPL |
| Ruby | gepub | yes | yes | full EPUB 2 and 3 metadata |
| Rust | epub | yes | no | reads metadata, spine, TOC, resources; GPL-3.0 |
| Rust | epub-builder | no | yes | generates EPUB 2 or 3 with TOC |
| PHP | PHP eBook | yes | basic | metadata, cover, chapters; also MOBI and FB2 |
By language#
- EPUB libraries for C/C++ Open-source C and C++ libraries for EPUB e-books: MuPDF lays out, renders and extracts text from EPUB and converts it to PDF. Code examples.
- EPUB libraries for C# Open-source .NET libraries for EPUB: VersOne.Epub reads EPUB 2 and 3 books, QuickEPUB creates EPUB files from HTML. Comparison and code examples.
- EPUB libraries for Java Open-source Java library for reading and writing EPUB e-books: epub4j, the maintained fork of epublib, with code examples. Works on Android.
- EPUB libraries for Go Open-source Go libraries for EPUB: go-epub creates EPUB 3 files and goreader/epub reads metadata, manifest and spine. Code examples.
- EPUB libraries for Python Open-source Python libraries for EPUB: EbookLib reads and writes EPUB 2 and 3, PyMuPDF extracts text, renders pages and converts EPUB to PDF. Code examples.
- EPUB libraries for Ruby Open-source Ruby library for reading and writing EPUB e-books: gepub handles all EPUB 2 and EPUB 3 metadata. Code examples.
- EPUB libraries for Rust Open-source Rust crates for EPUB: epub reads metadata, chapters and resources, epub-builder generates EPUB 2 and EPUB 3 files. Code examples.
- EPUB libraries for PHP Open-source PHP library for EPUB: PHP eBook (kiwilan/php-ebook) reads metadata, covers and chapters from EPUB, MOBI and FB2. Code examples.