3 ms·
Since EPUBs are just zipped HTML files, I guess rendering can be done more efficiently by the browser itself rather than by custom rendering on an HTML canvas.
by woodson 2y ago
Since EPUBs are just zipped HTML files, I guess rendering can be done more efficiently by the browser itself rather than by custom rendering on an HTML canvas.
- felipefar 2y agoYou're right. In that case you could implement the unzipping and metadata parsing in WASM and just hand the HTML to the browser to be rendered. It's still useful since browsers don't come with built-in EPUB support.
- ffsm8 2y agoI wrote an epub reader a few years ago and this is false. most epubs are just zipped html, but not all. There are different versions to this file format and some need to be parsed as xml. The chapter files will mostly adhere to html with caveats wrt anchor tags, image sources and similar as well as metadata wont be parsed/work with html parsers.
- felipefar 2y agoCan't you preprocess them with a custom parser and then hand over a conformant HTML to the browser?
- ffsm8 2y agoYes, but while thatd be a lot easier for epub (vs PDF), you can fundamentally do that for any other format too. You could even - technically - take a picture as an input and then render it via background color rgb() using divs pixel-by-pixel. thatd still fall under that description.