Bug 426921 - Okular doesn't render the table of contents of some epubs.
Summary: Okular doesn't render the table of contents of some epubs.
Status: REOPENED
Alias: None
Product: okular
Classification: Applications
Component: EPub backend (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-24 09:17 UTC by Dashon
Modified: 2021-03-29 00:53 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Document in epub format (899.90 KB, application/epub+zip)
2020-09-24 09:52 UTC, Dashon
Details
Document in pdf format (777.72 KB, application/pdf)
2020-09-24 09:52 UTC, Dashon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dashon 2020-09-24 09:17:44 UTC
SUMMARY
Not every pdf file/epub shows a table of contents in okular. For example I saved a google doc that had a table of contents to pdf then opened in okular. There was no table of contents in the file. Opening the pdf with calibre ebook viewer shows part of the table of contents. Saving the same document to epub. The entire table of contents is shown in calibre ebook reader (understandably). However the table of contents still was not shown in okular. In conclusion, there seem to be hiccups for some pdf and epub files in okular when it comes to the table of contents.

STEPS TO REPRODUCE
1. Generate pdf or epub that contains a table of contents from google docs.
2. Open with okular
3. Look to see if table of contents section is shown

OBSERVED RESULT
No section containing table of contents.

EXPECTED RESULT
Table of contents rendered allowing for easy navigation of long files.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20200919
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.74.0
Qt Version: 5.15.1
Kernel Version: 5.8.7-1-default
OS Type: 64-bit
Processors: 4 × Intel® Core™ i7-7500U CPU @ 2.70GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 620
Comment 1 Albert Astals Cid 2020-09-24 09:27:45 UTC
Okular doesn't generate table of contents, will only show one if the document has one by itself.
Comment 2 Dashon 2020-09-24 09:39:32 UTC
(In reply to Albert Astals Cid from comment #1)
> Okular doesn't generate table of contents, will only show one if the
> document has one by itself.

Generate was the wrong word here. The documents I am referring to do already have table of contents by themselves that okular is not showing.
Comment 3 Dashon 2020-09-24 09:41:22 UTC
(In reply to Albert Astals Cid from comment #1)
> Okular doesn't generate table of contents, will only show one if the
> document has one by itself.

Changed the title to more accurately reflect the problem
Comment 4 Albert Astals Cid 2020-09-24 09:46:48 UTC
Please attach such a document
Comment 5 Dashon 2020-09-24 09:52:06 UTC
Created attachment 131904 [details]
Document in epub format

This is the online notes in the form of a condensed book for my cryptography class. This is one in epub format. Next I will upload the same document in pdf format.
Comment 6 Dashon 2020-09-24 09:52:44 UTC
Created attachment 131905 [details]
Document in pdf format
Comment 7 Dashon 2020-09-24 09:53:34 UTC
(In reply to Albert Astals Cid from comment #4)
> Please attach such a document

I have attached the documents in question.
Comment 8 Yuri Chornoivan 2020-09-24 10:27:38 UTC
ToC for cannot be shown in FoxIt Reader and PDF-XChage as well. Can you explicitly name the application that can show the ToC?

ePub contains a separate ToC in nav.xhtml which seems confusing parsing.
Comment 9 Dashon 2020-09-24 10:34:39 UTC
(In reply to Yuri Chornoivan from comment #8)
> ToC for cannot be shown in FoxIt Reader and PDF-XChage as well. Can you
> explicitly name the application that can show the ToC?
> 
> ePub contains a separate ToC in nav.xhtml which seems confusing parsing.

I used calibre ebook-viewer to open the pdf file as well as I mentioned in my summary. Also as mentioned before, it shows a part of the ToC
Comment 10 Albert Astals Cid 2020-09-24 11:34:43 UTC
That PDF file does not have any table of contents.
Comment 11 Dashon 2020-09-24 11:40:05 UTC
(In reply to Albert Astals Cid from comment #10)
> That PDF file does not have any table of contents.

Alright thanks for looking. Seems I must have been mistaken.
Comment 12 Albert Astals Cid 2020-09-24 12:41:08 UTC
The epub file defenitely contains a table of contents. reopening the bug.

(In reply to Yuri Chornoivan from comment #8)
> ToC for cannot be shown in FoxIt Reader and PDF-XChage as well. Can you
> explicitly name the application that can show the ToC?
> 
> ePub contains a separate ToC in nav.xhtml which seems confusing parsing.

the problem with the parsing seems to be that the toc is inside the manifest and not as an attribute of the spine like the ebook-tools code expects it to be.

Unfortunately ebook-tools seems to be dead, with the last commit more than 6 years ago https://sourceforge.net/p/ebook-tools/code/log/

Also discussed in the last team meeting was potential dropping epub support since our support is kind of lacking, not totally decided, but a probability