Add PDF support

This commit is contained in:
John Factotum
2023-10-08 21:27:06 +08:00
parent bcfb942935
commit a63a68eda0
6 changed files with 76736 additions and 2 deletions
+8 -1
View File
@@ -3,7 +3,7 @@
Library for rendering e-books in the browser.
Features:
- Supports EPUB, MOBI, KF8, FB2, CBZ
- Supports EPUB, MOBI, KF8 (AZW3), FB2, CBZ, PDF (experimental; requires PDF.js), or add support for other formats yourself by implementing the book interface
- Pure JavaScript
- Small and modular
- No dependencies
@@ -128,6 +128,12 @@ It can read both MOBI and KF8 (.azw3, and combo .mobi files) from a `File` (or `
Note that KF8 files can contain fonts that are zlib-compressed. They need to be decompressed with an external library. The demo uses [fflate](https://github.com/101arrowz/fflate) to decompress them.
### PDF and Other Fixed-Layout Formats
There is a proof-of-concept, highly experimental adapter for [PDF.js](https://mozilla.github.io/pdf.js/), with which you can show PDFs using the same fixed-layout renderer for EPUBs.
CBZs are similarly handled like fixed-layout EPUBs.
### The Renderers
It has two renderers, one for paginating reflowable books, and one for fixed-layout. They are custom elements (web components).
@@ -292,3 +298,4 @@ MIT.
Vendored libraries for the demo:
- [zip.js](https://github.com/gildas-lormeau/zip.js) is licensed under the BSD-3-Clause license.
- [fflate](https://github.com/101arrowz/fflate) is MIT licensed.
- [PDF.js](https://mozilla.github.io/pdf.js/) is licensed under Apache.