After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 539347 - support EPUB format
support EPUB format
Status: RESOLVED WONTFIX
Product: evince
Classification: Core
Component: backends
2.22.x
Other Linux
: Normal enhancement
: ---
Assigned To: Evince Maintainers
Evince Maintainers
: 589464 623007 701250 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-06-20 18:27 UTC by Pedro Villavicencio
Modified: 2017-07-27 11:50 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22



Description Pedro Villavicencio 2008-06-20 18:27:54 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,
Comment 1 Carlos Garcia Campos 2008-09-15 07:54:06 UTC
The contents are just xhtml documents, does anybody know whether it is possible to render into an offscreen cairo surface with webkit?
Comment 2 Carlos Garcia Campos 2009-07-23 09:36:59 UTC
*** Bug 589464 has been marked as a duplicate of this bug. ***
Comment 3 Carlos Garcia Campos 2009-07-23 09:37:49 UTC
> 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. 
Comment 4 Ross Burton 2009-07-23 11:35:31 UTC
I guess the interesting thing is that XHTML isn't paginated, so the backend would need to paginate it for you.
Comment 5 Sayamindu Dasgupta 2009-07-23 15:02:02 UTC
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.

Comment 6 Bastien Nocera 2010-06-22 15:09:49 UTC
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.
Comment 7 Carlos Garcia Campos 2010-06-22 15:17:58 UTC
The main problem is still pagination.
Comment 8 Sayamindu Dasgupta 2010-06-22 18:52:32 UTC
(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
Comment 9 Carlos Garcia Campos 2010-06-28 07:26:13 UTC
*** Bug 623007 has been marked as a duplicate of this bug. ***
Comment 10 David 2011-01-15 23:44:16 UTC
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.
Comment 11 Juanjo Marín 2011-01-16 08:32:19 UTC
I'm not a very skilled programmer, but this bug is in my roadmap, unless somebody else do it before I try it.
Comment 12 Daniel Garcia 2011-04-23 09:10:58 UTC
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
Comment 13 Bastien Nocera 2011-04-28 01:43:53 UTC
(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
Comment 14 Daniel Garcia 2011-04-28 07:23:43 UTC
(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.
Comment 15 Carlos Garcia Campos 2011-04-30 12:06:11 UTC
what about using libepub? I think it already does the pagination.
Comment 16 Juanjo Marín 2011-05-14 02:20:00 UTC

(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 ?
Comment 17 David Prieto 2011-05-14 05:49:26 UTC
Do we really need pagination for ebooks? Wouldn't separating the chapters be enough?
Comment 18 Bastien Nocera 2011-05-14 15:15:48 UTC
(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.
Comment 19 David Prieto 2011-05-14 16:04:07 UTC
Bastien,

You're totally right, I was thinking only about browsing the document and totally forgot all other cases. Please scratch that.
Comment 20 Seán de Búrca 2011-07-01 22:45:02 UTC
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
Comment 21 Yajo 2012-02-28 12:36:49 UTC
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?
Comment 22 Guido Günther 2013-03-16 19:46:22 UTC
Would that make for a nice GSoC project?
Comment 23 Paolo Melchiorre 2013-05-24 08:02:11 UTC
Please add ePub format support to Evince so it'll be a modern viewer.
Comment 24 Christian Persch 2013-05-30 11:27:28 UTC
*** Bug 701250 has been marked as a duplicate of this bug. ***
Comment 25 Denis Donici 2014-02-18 06:54:19 UTC
What is needed to be done in order to implement epub support for evince?
Comment 26 Marta Milakovic 2014-04-11 20:29:34 UTC
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
Comment 27 Emilio Pozuelo Monfort 2014-05-02 15:10:14 UTC
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
Comment 28 Bastien Nocera 2014-09-30 10:03:34 UTC
FYI, it got added to atril now:
https://github.com/mate-desktop/atril/pull/84
Comment 29 Aurélio A. Heckert 2015-11-21 01:16:34 UTC
Hi! Any news?
Comment 30 Bastien Nocera 2015-11-21 16:30:21 UTC
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.
Comment 31 Bastien Nocera 2016-06-05 17:57:18 UTC
See also bug 740971 for gnome-books support for epub.
Comment 32 Hussam Al-Tayeb 2016-06-27 18:41:12 UTC
Maybe evince developers can use this? https://git.gnome.org/browse/libgepub/
Comment 33 Bastien Nocera 2017-07-27 11:50:17 UTC
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