Bug 334711 - EPUB format is not handled correctly (TOC, images, pages not displayed)
Summary: EPUB format is not handled correctly (TOC, images, pages not displayed)
Alias: None
Product: okular
Classification: Applications
Component: EPub backend (show other bugs)
Version: 0.19.0
Platform: OpenSUSE Linux
: NOR normal with 10 votes (vote)
Target Milestone: ---
Assignee: Okular developers
Depends on:
Reported: 2014-05-13 15:34 UTC by Stas
Modified: 2018-08-15 17:14 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:

sample ePub file (7.94 KB, application/octet-stream)
2014-06-24 09:00 UTC, tnemeth

Note You need to log in before you can comment on or make changes to this bug.
Description Stas 2014-05-13 15:34:46 UTC
When opening some EPUB files, TOC often displays page 1 even if the file has more than 200 pages, some pages and some blocks are completely invisible.

Compared with Calibre viewing, which is far from Okular in terms of usability, but has no issues viewing EPUB files.

Calibre: http://calibre-ebook.com/

Reproducible: Always

Steps to Reproduce:
1. Download sample epub file: http://www.blacklibrary.com/Downloads/Product/epub/Escalation-Preview.epub
2. Open in Okular
3. Compare with Calibre
Actual Results:  
1. TOC displays 5 chapters with pages: 1, 1, 1, 6, 1; Calibre can navigate through TOC correctly.
2. After greenish image, huge chunk of text and another image is completely missing.
3. Fonts for title "Baneblade" and the line below is not antialiased, hard to read on smaller zoom.
4. Image of baneblade does not fit the page.
5. All of the document contents is missing after crewman image.

Expected Results:  
1. Full document contents should be displayed.
2. Images should be centered/aligned correctly.
3. Probably TOC should not display page numbers, just jump to specified anchor, because page number has to be recalculated every time window size is changed. But even if numbers will be displayed incorrectly - more importantly is to jump to specified anchor than seeing actual number.

One more preview file that is missing almost all the pages when viewed in Okular: http://www.blacklibrary.com/Downloads/Product/epub/Imperial-Knights-Preview.epub

Using OpenSUSE factory KDE packages from here:
Comment 1 tnemeth 2014-06-24 09:00:06 UTC
Created attachment 87362 [details]
sample ePub file

This is a sample "hand crafted" epub file that okular cannot read. Both FBreader and Calibre can. the EPUB validator says the file is fine.

Comment 2 Gilbert Assaf 2018-08-15 17:14:45 UTC
Git commit fcf148b75b98462b927da605ca76ee69ada31fd1 by Gilbert Assaf.
Committed on 15/08/2018 at 17:14.
Pushed by gassaf into branch 'master'.

Fixes url whitespaces in epub documents

libepub can't handle whitespace url encodings. This is why epub documents containing whitespaces urls aren't
displayed correctly. Since libepub doesn't seem to be maintained anymore, it might be better to fix this issue here.

Test Plan: Example epubs are in the ticket.

Reviewers: #okular, aacid

Reviewed By: #okular, aacid

Subscribers: ngraham, aacid, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D14310

M  +10   -0    generators/epub/CMakeLists.txt
A  +-    --    generators/epub/autotests/data/test.epub
A  +84   -0    generators/epub/autotests/epubgeneratortest.cpp     [License: GPL (v2+)]
M  +5    -1    generators/epub/converter.cpp