View Single Post
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, 257 views)
File Type: zip epub-print-page-approximator_v1.1.5_source.zip (33.5 KB, 245 views)
Thertzler is offline   Reply With Quote