05-01-2017, 10:35 PM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: May 2017
Device: desktop
|
Displaying the page number in TOC items
In the ebook viewer, I would like to display the page number in which an entry in the TOC begins. I see the items have some properties that might be useful, like starts_at, start_src_offset, or start_anchor. I'm having trouble in finding out how to calculate the page with those values.
Last edited by cricobs; 05-01-2017 at 10:39 PM. Reason: yes |
05-01-2017, 11:24 PM | #2 |
creator of calibre
Posts: 44,560
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
There are no page numbers in ebooks. If you mean the simulated page numbers displayed, you cannot since calculating them requires rendering every html file in advance.
|
Advert | |
|
05-02-2017, 09:36 AM | #3 |
Junior Member
Posts: 3
Karma: 10
Join Date: May 2017
Device: desktop
|
So there is no easy way. Can the item.start_src_offset be used to calculate the page using the page offset from the top and height as reference, or something like that? Haven't looked at the code yet, but any clues on how the the fake page number is being calculated? I hope you don't mind I forked your project "calibre highway" on github, . Heavily modifying the viewer, you will hate it :'(
|
05-02-2017, 11:03 AM | #4 |
creator of calibre
Posts: 44,560
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I never mind forks -- that's why calibre is open source -- to encourage others to learn contribute and even fork.
Just so you knwo the existing viewer is in maintenance mode. I have developed an in browser viewer for calibre 3 and the code base of that viewer will eventually replace this one, probably using QtWebEngine instead of QtWebKit. As for how the fake page number is calculated, see set_page_number and scroll_fraction |
05-02-2017, 03:00 PM | #5 |
Junior Member
Posts: 3
Karma: 10
Join Date: May 2017
Device: desktop
|
Thanks for the heads up! I'm actually planning on a standalone viewer though.
Thanks for your awesome work! |
Advert | |
|
Tags |
item details and options, page count, toc |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
all toolbar items not displaying? | sovre | Calibre | 1 | 08-06-2011 08:37 PM |
Problem displaying selected items | garyft | Calibre | 1 | 05-24-2011 05:29 PM |
Sort by and displaying page number | JasonAug | Library Management | 3 | 04-01-2011 04:45 AM |
Increase the number of items per page? | tmb20x | Amazon Kindle | 1 | 11-04-2010 03:12 PM |
Displaying the number of the next page. | cmm | Kobo Reader | 4 | 09-09-2010 11:54 PM |