Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Reading and Management

Notices

Reply
 
Thread Tools Search this Thread
Old 11-14-2022, 09:17 PM   #16
Aleron Ives
Wizard
Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.
 
Posts: 1,024
Karma: 11500112
Join Date: Sep 2022
Device: Kobo Libra 2
Quote:
Originally Posted by Thertzler View Post
I'd love to update the opening post with this as well but I don't see the edit button mentioned in the FAQ... some restriction for new users I assume?
Yes. New users cannot access all features until they reach certain post count thresholds. I've sent a report to a moderator to see if somebody can grant you that ability sooner, since you're obviously not a spambot.

Quote:
Originally Posted by Thertzler View Post
But maybe a feature like that, some sort of page count suggestion, could be added.
Thanks for taking it under consideration. I know it's not the kind of page counting mechanism you originally envisioned, but it would be nice to have one CLI tool for all our EPUB page numbering tasks.

As far as word counting goes, I would think that you'd count any group of characters preceeded and followed by a space or newline as a word, so that differences in punctuation would not influence the count.

For instance, my text editor's word counter says the preceeding sentence has 37 words, even though it contains commas and a contraction, which matches how I would count the words myself.
Aleron Ives is offline   Reply With Quote
Old 11-14-2022, 09:18 PM   #17
Sirtel
Grand Sorcerer
Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.
 
Sirtel's Avatar
 
Posts: 10,141
Karma: 224760044
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
Yes, it works now with epub. Kepubs, of course, still use 1 screen=1 page.
Sirtel is offline   Reply With Quote
Old 11-14-2022, 09:42 PM   #18
Aleron Ives
Wizard
Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.
 
Posts: 1,024
Karma: 11500112
Join Date: Sep 2022
Device: Kobo Libra 2
Isn't there a patch to force KEPUB to use the regular EPUB page numbers? Maybe that would work (if you're willing to flash new firmware to test)?
Aleron Ives is offline   Reply With Quote
Old 11-14-2022, 09:46 PM   #19
Sirtel
Grand Sorcerer
Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.Sirtel ought to be getting tired of karma fortunes by now.
 
Sirtel's Avatar
 
Posts: 10,141
Karma: 224760044
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
Quote:
Originally Posted by Aleron Ives View Post
Isn't there a patch to force KEPUB to use the regular EPUB page numbers? Maybe that would work (if you're willing to flash new firmware to test)?
I found a post by late Davidfor saying that this doesn't work anymore. Kepubs use screen/page system no matter what.

Well, there's an option to display Adobe numbers on the side margin and perhaps that would work for kepubs as well. But it's a lousy option, as it would cover text if you had narrow margins. I have it disabled at the moment on my Kobos, but I'll probably try it some day. Still, I don't think I'll want to use it on a regular basis.

Edit: I found another discussion where it's confirmed that those side numbers only work with epubs (where they're redundant anyway). So no joy there.

Last edited by Sirtel; 11-14-2022 at 09:58 PM.
Sirtel is offline   Reply With Quote
Old 11-15-2022, 12:11 AM   #20
Aleron Ives
Wizard
Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.
 
Posts: 1,024
Karma: 11500112
Join Date: Sep 2022
Device: Kobo Libra 2
Yes, that option is only for EPUB, and whether it works depends upon the CSS of each book. Some books properly show the page number in the margins, whereas others show the page number on top of the text, making some words at the end of a line unreadable. It's too bad the WebKit renderer won't let you use other page numbering schemes anymore.
Aleron Ives is offline   Reply With Quote
Old 11-18-2022, 02:46 PM   #21
Thertzler
Member
Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.
 
Posts: 13
Karma: 1138306
Join Date: Mar 2018
Device: none
Lightbulb

Quote:
Originally Posted by Aleron Ives View Post
Thanks for taking it under consideration. I know it's not the kind of page counting mechanism you originally envisioned, but it would be nice to have one CLI tool for all our EPUB page numbering tasks.
While not part of the orignal plan, it turned out that the feature was not actually that complicated to add (honestly, adding the page-map.xml was almost trickier).

Print Page Approximator v1.1.5 should implement pretty much everything you've described.

There's now a new flag, "--autopage" which tells the script to automatically calculate the pages using the numeric second argument as a definition of a single page.

For example:
Code:
.\page_approximator.exe .\example_book.epub 30 --autopage --pagingmode lines
...will paginate your book with 30 lines per page for however many pages that results in.

As usual more details are in the readme on GitHub.

Quote:
Originally Posted by Aleron Ives View Post
As far as word counting goes, I would think that you'd count any group of characters preceeded and followed by a space or newline as a word, so that differences in punctuation would not influence the count.
That's certainly an easy programmatic definition which the Python split() method already incorporates natively so that's what I went with.
Personally I still think that defining pages by word count is a bit questionable because one word could have 2 letters or maybe it could have 16 letters and both would be the same with this method. But well, offering the option doesn't hurt I guess.
Attached Files
File Type: zip page_approximator_v1.1.5_win_x64.zip (10.44 MB, 131 views)
File Type: zip epub-print-page-approximator_v1.1.5_source.zip (33.5 KB, 134 views)
Thertzler is offline   Reply With Quote
Old 11-18-2022, 10:37 PM   #22
Aleron Ives
Wizard
Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.Aleron Ives ought to be getting tired of karma fortunes by now.
 
Posts: 1,024
Karma: 11500112
Join Date: Sep 2022
Device: Kobo Libra 2
Thanks for your hard work. It's good to have one tool for all your potential EPUB pagination needs.

I can't run the precompiled binary on Windows 7 due to missing DLLs, so I guess I'll have to try it out on one of my Linux machines.

Quote:
Originally Posted by Thertzler View Post
Personally I still think that defining pages by word count is a bit questionable because one word could have 2 letters or maybe it could have 16 letters and both would be the same with this method.
Yes, and the number of words that can fit on a page varies widely depending upon how much dialogue there is. Even so, it provides a standardised metric for comparing book lengths, which may be useful.

Similarly, the idea of judging paper book length by page count has always been rather silly, as the page size, font size, margin size, and line spacing differ wildly between books. Page count was just the only easily obtained metric with paper books, so it was better than nothing.
Aleron Ives is offline   Reply With Quote
Old 12-16-2022, 07:06 AM   #23
Thertzler
Member
Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.
 
Posts: 13
Karma: 1138306
Join Date: Mar 2018
Device: none
Version 1.1.7 is out!

So during the last month I've continued tweaking the tool, adding some more niche features. I think all functionality should be covered now, which makes this a good time to post the update here.

Version 1.1.6 was the big Roman Numeral update that adds lots of functionality for handling front matter sections. You can either tell the book outright how many front matter pages there are as with the normal page count, or you can combine it with the page=>ToC map and really go nuts micromanaging.

Version 1.1.7 added mostly bug fixes and some more options for handling documents that are either not included in the ebook's "spine" definition or were designated as not "linear", as those were special cases that I was not aware of when I started this project but now they can be handled in a variety of ways.

Since I am now able to edit the opening post, and can just update its Attachments I also no longer need to duplicate them across many posts, so check out the new versions there.

...Still thinking about reworking it into a calibre plugin in the future.
Thertzler is offline   Reply With Quote
Old 04-02-2023, 03:30 PM   #24
Thertzler
Member
Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.Thertzler ought to be getting tired of karma fortunes by now.
 
Posts: 13
Karma: 1138306
Join Date: Mar 2018
Device: none
v1.1.8 with new features

Recently I noticed that one of my ebooks contained 'span' tags with the epub:type pagebreak attribute that were theoretically valid page markers, but my reader didn't recognize them because they were not properly listed in the nav file.
There were also some other curious books which had other kinds of non-standard page markers that naturally also didn't work "properly" but since they were there I thought it would be a nice feature to detect such page markers in a book and use them for pagination instead calculating pages manually.

So I went and updated my Print Page Approximator script with that feature and the result is version 1.1.8.

Besides passing a page number as the first argument after the filename you can now pass a css-like selector to find page marker tags to be used as the basis for the page list.

for the most basic constellation in which the tags are already valid, fixing the page list is as easy as this:

Code:
.\page_approximator.exe .\example_book.epub "[epub:type=pagebreak]"
For more "custom" page markers the selector might have to be more involved, the more advanced documentation can be found on GitHub.
Needless to say this is more of a power user feature for people who already like to mess around with the innards of their books in editors like Calibre and such, but still... less manual work.

As usual, the attachments are updated in the opening post.
Thertzler is offline   Reply With Quote
Reply

Tags
epub, page breaks, page numbering, python, tool


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
embed epub3 in a web page increase ePub 2 06-30-2020 11:41 AM
Stop audio on another page for Epub3 Barra ePub 7 09-12-2019 10:12 AM
Print page range in viewer outputs single empty page larzeb Library Management 2 04-30-2013 05:24 AM
Start page on fixed layout epub3 brunobruno ePub 12 03-30-2013 01:50 AM
EPUB3 - Float audio pane with page turns _savage ePub 22 01-30-2013 01:38 AM


All times are GMT -4. The time now is 03:16 PM.


MobileRead.com is a privately owned, operated and funded community.