GNOME Bugzilla – Bug 539347
support EPUB format
Last modified: 2017-07-27 11:50:17 UTC
this report has been filed here: https://bugs.edge.launchpad.net/ubuntu/+source/evince/+bug/241736 "I just got an electronic reader and discovered that the new standard e-book format EPUB can't be read by any program in Ubuntu. It would be a good thing if the default document reader, Evince, could support this type of file. http://www.mobileread.com/forums/showthread.php?t=22282" Thanks,
The contents are just xhtml documents, does anybody know whether it is possible to render into an offscreen cairo surface with webkit?
*** Bug 589464 has been marked as a duplicate of this bug. ***
> EPUB support would be really nice. > > http://www.idpf.org/specs.htm is the spec. It appears to be a mashup of XHTML > and metadata in a zip. Is there a preferred way to render HTML inside evince? > I think we could use webkit for that, but still we have at least two options: - Figure out how to render pages offscreen with webkit and use the current evince code, we would only have to add a new backend for epub. - Make EvView an interface with two implementations EvImageView (the current one, based on pixbuf images) and EvHTMLView which would use WebkitWebView to render the pages. Second option requires much more work, but it would make easier to support any other kind of HTML based document.
I guess the interesting thing is that XHTML isn't paginated, so the backend would need to paginate it for you.
There is an extension used by Adobe to implement pagination, however, it is not a part of the official Epub spec. There is a way to do pagination in Epub (as outlined in http://groups.google.com/group/epubcheck/browse_thread/thread/6d2994b3538ff687), however, I have not come across any actual Epub file which uses it. I have tried to use mozilla-headless (http://hg.mozilla.org/incubator/offscreen) to render the XHTML files to a pixmap, however it did not work for me from a Evince backend plugin (it works in a standalone mode though). Maybe someone with a better understanding of Evince than me would be able to accomplish that.
GtkOffscreenWindow would allow you to render the webkit out-of-screen, though you'd be losing the interesting text properties if you just rendered it out of screen.
The main problem is still pagination.
(In reply to comment #7) > The main problem is still pagination. You can find the method used by Adobe Reader application (Digital Editions) for pagination in the EPUB Best Practices Guide at http://www.adobe.com/devnet/digitalpublishing/epubs/EPUBBestPractices-1_0_3.epub
*** Bug 623007 has been marked as a duplicate of this bug. ***
It's been a while, any updates on this matter? I just wanted to file this feature request too, so here I do! It would be very nice to use my favorite document viewer for ebooks, instead of those other, kind of odd viewers.
I'm not a very skilled programmer, but this bug is in my roadmap, unless somebody else do it before I try it.
I've developed a simple lib [1] that provides an epub rendered widget using glib and webkit. I think that could be a first step to get epub support in evince. This lib is based on libgxps, and currently is stored in my own server, do you think it should be in gnome.org? Having that, the main problem is how to use that for supporting epub docs in evince. Currently evince is page based and epub isn't it, how do I manage this problem? adding continuous documents to evince or making epub paged? [1] http://wadobo.com/repos/libgepub.git
(In reply to comment #12) > I've developed a simple lib [1] that provides an epub rendered widget using > glib and webkit. I think that could be a first step to get epub support in > evince. > > This lib is based on libgxps, and currently is stored in my own server, do you > think it should be in gnome.org? Most likely, yes. Is it different enough that it wouldn't be accepted within libgxps itself? > Having that, the main problem is how to use that for supporting epub docs in > evince. Currently evince is page based and epub isn't it, how do I manage this > problem? adding continuous documents to evince or making epub paged? I would think the latter. I would expect it to a process similar to printing a web page, in that you'd probably need to add configuration of font sizes, and then paginate based on the locale's default page size. So a person in Europe would see a result similar to printing a web page on an A4 piece of paper. > [1] http://wadobo.com/repos/libgepub.git
(In reply to comment #13) > > This lib is based on libgxps, and currently is stored in my own server, do you > > think it should be in gnome.org? > > Most likely, yes. Is it different enough that it wouldn't be accepted within > libgxps itself? It's a different project. Maybe that kind of libs should be in a parent project, somethink like libgdocs or someting like that, but currently is a different project. So I think that I'll create a new repo in git.gnome.org and added it. > > Having that, the main problem is how to use that for supporting epub docs in > > evince. Currently evince is page based and epub isn't it, how do I manage this > > problem? adding continuous documents to evince or making epub paged? > > I would think the latter. I would expect it to a process similar to printing a > web page, in that you'd probably need to add configuration of font sizes, and > then paginate based on the locale's default page size. I agree with you, that would be the easiest way. I'll start to work in that.
what about using libepub? I think it already does the pagination.
(In reply to comment #15) > what about using libepub? I think it already does the pagination. If you're talking about libepub from the ebook-tools, AFAIK, it seems to me it doesn't do any pagination. Okular uses this library, and the pagination is done through QTextDocument defining a PageSize. AFAIK, all the pagination algorithms are based on the Knuth/Plass paragraph breaking algorithm. I think because epub is XML based, it seems appropiate to look for a XSL-FO library. The most famous is Apache FOP, but it is written in Java. The only C alternative I've found is xmlroff. BTW, we should only show a pagination version of ebooks or it's fine to introduce a reflow mode in Evince ?
Do we really need pagination for ebooks? Wouldn't separating the chapters be enough?
(In reply to comment #17) > Do we really need pagination for ebooks? Wouldn't separating the chapters be > enough? How would you do presentation mode without it, or even make sure that evince shows how the pages would be printed.
Bastien, You're totally right, I was thinking only about browsing the document and totally forgot all other cases. Please scratch that.
A few notes on pagination: For EPUB version 2.0.1, some epubs use DAISY's .ncx for pagination[1][2]. EPUB 3.0 includes its own pagination specification[3]. This doesn't solve the problem for 2.0.1 without NCX files, but I know that calibre's ebook-viewer app at least measures page position, although it doesn't have visible page breaks. Could that algorithm perhaps be appropriated? [1] http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.4.1 [2] http://www.niso.org/workrooms/daisy/Z39-86-2005.html#NCX [3] http://idpf.org/epub/30/spec/epub30-contentdocs.html#sec-xhtml-nav-def-types-pagelist
Are there any progresses on this? It's sad that, after almost 4 years, this free and open format is still unreadable... About the pagination problem, if EPUB are just XHTML with some extensions, and Epiphany prints webpages, have you thought about reusing some code from there?
Would that make for a nice GSoC project?
Please add ePub format support to Evince so it'll be a modern viewer.
*** Bug 701250 has been marked as a duplicate of this bug. ***
What is needed to be done in order to implement epub support for evince?
Hi, I applied for the GSoC project "eBook application based on Documents". In the proposal I evaluated two options of reading ePub files: 1. Browser mode - using epub.js [1] 2. Glib/GObject library for interfacing .epub files - integrating it within the existing Evince library. Good start here would be to reuse the library libgepub [2]. This library is unfinished but it could be a good start. We would have to implement pagination and maybe some extra stuff. I think the second solution would be much better because Evince could also use it and I it is necessary that we support .epub files. [1] http://fchasen.github.io/epub.js/ [2] https://github.com/danigm/libgepub
Apparently there is a GSOC project for adding epub support to atril (mate's evince fork), so maybe something from there can be reused for evince. http://mate-desktop.org/blog/2014-04-28-mate-desktop-gsoc-2014-projects/ http://www.google-melange.com/gsoc/project/details/google/gsoc2014/rootavish/5757334940811264
FYI, it got added to atril now: https://github.com/mate-desktop/atril/pull/84
Hi! Any news?
The rendering in atril is pretty awful. Feel free to try it out, but it's certainly not to the level of quality that we'd expect in evince.
See also bug 740971 for gnome-books support for epub.
Maybe evince developers can use this? https://git.gnome.org/browse/libgepub/
I don't think that ePubs fit into evince. All the formats that evince supports represent a digital version of physical pages, ePubs are reflowable, resizable, and you're expected to apply stylesheets to change the font size, margins, etc. Even if we thought we added ePub support, the number of additional controls necessary would make the UI even more complicated (font, font sizes, interline spacing, margins...) GNOME Books already supports ePubs, and there are stand-alone ePub viewers available now, as per: http://www.omgubuntu.co.uk/2017/07/best-ebook-reader-app-ubuntu