Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 12-02-2020, 01:22 PM   #1
ghmerrill
Connoisseur
ghmerrill began at the beginning.
 
ghmerrill's Avatar
 
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
Page numbers in Epub->PDF conversion

I THINK I can see a way around this that is mostly outside Calibre, but given that I see some pretty slick stuff in Calibre conversion documents, I wonder if I'm just missing something. Surely people handle this situation all the time. If it's already documented or discussed somewhere, just point me at it.

Here's the problem: Page numbers for "front matter" (title page, copyright, preface, etc.) should be lower case Roman numerals (i, ii, iii, etc.) beginning with i. Page numbers for the body of the book should be Arabic numerals (1, 2, 3, ...), and the generated table of contents should reference all of that correctly.

Is there some way I can cause this to happen in the Epub->PDF conversion process? Can I, for example, provide some HTML (depending on classes) that will cause numbering to emit LC Roman numerals for some files/sections and Arabic numerals for others? Is there something that I can insert on the Epub side to help or accomplish this? I see some murky references to a "pagelist" that Sigil might be able to generate, but there's nothing obvious in the Sigil tools about this (maybe a plugin?).

Just not sure which way to go on this. My work-around would be to take the Epub file apart, convert each part separately, and then patch any problems (e.g., in the table of contents) with direct PDF editing. But that seems pretty crude.

Thanks for any insight.
ghmerrill is offline   Reply With Quote
Old 12-02-2020, 02:09 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You can specify JS expressions to generate arbitrary things for page numbers. Read the https://manual.calibre-ebook.com/con...verting-to-pdf
kovidgoyal is online now   Reply With Quote
Advert
Old 12-02-2020, 02:35 PM   #3
ghmerrill
Connoisseur
ghmerrill began at the beginning.
 
ghmerrill's Avatar
 
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
I've read that about a dozen times at this point, and was afraid you might say this . Since I utterly deplore Javascript and haven't written any of it in ... uh ... almost 20 years, I was hoping to avoid that. But I suppose that is the nature of the beast (the beast in this case being the CSS/HTML environment -- which is also pretty deplorable). Once you go down that dark road, there is no way back.

Thanks.
ghmerrill is offline   Reply With Quote
Old 12-02-2020, 09:36 PM   #4
ghmerrill
Connoisseur
ghmerrill began at the beginning.
 
ghmerrill's Avatar
 
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
So in looking around I came across your comment in this old thread:
http://www.mobileread.mobi/forums/sh...d.php?t=232830

And I wonder if at this point in time the Calibre conversion process honors the Epub3 pagebreak feature and if this wouldn't be a direct and non-programmatic way to accomplish what I want to do in numbering a few pages with Roman numerals (maybe together with page-list, etc. This would avoid my having to write Javascript and would be Epub3 compliant.

I confess that I haven't experimented with this yet, and I'm not clear on how this would bottom out in the display of page numbers, but it kind of looks promising, if somewhat mysterious at the moment.

Any comment on this? Any experience using pagebreak/pagelist? Do you know of any examples of this?

Thanks.
ghmerrill is offline   Reply With Quote
Old 12-02-2020, 10:34 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It doesn't, and this would require like 5 lines of javascript, however bad any language is (and JS is bad enough that I create and use a transpiler of my own design for it) writing five lines in one is not that hard.
kovidgoyal is online now   Reply With Quote
Advert
Old 12-02-2020, 11:23 PM   #6
ghmerrill
Connoisseur
ghmerrill began at the beginning.
 
ghmerrill's Avatar
 
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
True enough, but I'm a little unclear on where the five lines go and what variables/parameters I have access to in writing it. I'm guessing that I would reference _PAGENUM_ and somehow call a Javascript function/method to render it appropriately as LC Roman, and then just dump the code as a script in the footer?

Along those lines, you document "some more variables" for use in headers and footers. Are there others? Documented, or do I need to look in Calibre source for them?

Thanks.
ghmerrill is offline   Reply With Quote
Old 12-03-2020, 12:09 AM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
All available variables are documented.
kovidgoyal is online now   Reply With Quote
Old 12-03-2020, 08:09 AM   #8
ghmerrill
Connoisseur
ghmerrill began at the beginning.
 
ghmerrill's Avatar
 
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
Still struggling with this a bit. I can change how the page numbers are displayed by dropping JS in the footer template. But of course this only affects the DISPLAY of the page numbers (better: numerals) on the page. It doesn't affect how the page numbers are rendered in the Printed Table of Contents. I'm not seeing how to do that.
ghmerrill is offline   Reply With Quote
Old 12-03-2020, 08:11 AM   #9
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,497
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by ghmerrill View Post
Any comment on this? Any experience using pagebreak/pagelist? Do you know of any examples of this?
An EPUB 2 pageList (or EPUB 3 page-list) can be used by some e-readers to show the page number associated with whatever content is currently displayed and supports the ability for the user to go to a specific page in the book. It is usually created manually based on the page breaks prevent in a specific printed edition of the book.

To create a pageList you would need to insert the markup for each page number in your EPUB at the point where you want that new page to begin, a tedious process. Even if you did that I don't believe that calibre would make use of it during conversion to PDF anyway.
jhowell is online now   Reply With Quote
Old 12-03-2020, 08:20 AM   #10
ghmerrill
Connoisseur
ghmerrill began at the beginning.
 
ghmerrill's Avatar
 
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
Quote:
Originally Posted by jhowell View Post
To create a pageList you would need to insert the markup for each page number in your EPUB at the point where you want that new page to begin, a tedious process. Even if you did that I don't believe that calibre would make use of it during conversion to PDF anyway.
Yeah, I think that's been established. It's starting to look like whatever I do will require some hand-editing of the PDF -- or constructing my own TOC -- which will probably be less burdensome than continuing to try to find a general solution for what is hopefully a one-time thing. I'm just curious what other people do about this numbering issue with front matter vs. body of book and the printed table of contents that Calibre generates. And I haven't tried other converters -- but like I said ... if I have to diddle with the PDF anyway, I'm not inclined to spin my wheels looking for something more elegant at this point. Or I could convert the whole thing to LaTex and produce a genuine PDF with total control -- but that's also not an attractive solution to a problem involving a half dozen pages and a TOC.
ghmerrill is offline   Reply With Quote
Old 12-03-2020, 08:29 AM   #11
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,497
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by ghmerrill View Post
I'm just curious what other people do about this numbering issue with front matter vs. body of book and the printed table of contents that Calibre generates.
Most people compose their books in a word processor like Microsoft Word. That has support for page numbers of varying types and auto TOC generation. They then use that a the source for creation of a printable PDF and for conversion to EPUB.
jhowell is online now   Reply With Quote
Old 12-03-2020, 08:42 AM   #12
ghmerrill
Connoisseur
ghmerrill began at the beginning.
 
ghmerrill's Avatar
 
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
Yeah, that's what my wife did. She was willing to struggle with Word and its various issues, and has the experience to do that. Even so, it wasn't pleasant. I chose early on to go via Sigil since it seemed well-implemented and Epub seemed to be a better approach in several ways. I still don't regret that. But the whole Epub "flow" model of documents does make transition to a more traditional printed format less than straightforward. There are, of course, fairly powerful commercial tools available, but for me the cost of those for limited use made that an unreasonable choice.
ghmerrill is offline   Reply With Quote
Old 12-03-2020, 09:25 AM   #13
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
there is no way to use rendered footer output as page numbers in the generated toc.
kovidgoyal is online now   Reply With Quote
Old 12-03-2020, 09:44 AM   #14
ghmerrill
Connoisseur
ghmerrill began at the beginning.
 
ghmerrill's Avatar
 
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
Quote:
Originally Posted by kovidgoyal View Post
there is no way to use rendered footer output as page numbers in the generated toc.
Of course. I just wanted to be sure there wasn't some other undocumented approach that might be used. Thanks.

As it turns out, my easiest solution to this quite restricted problem is to use a split/convert to PDF/edit with PDFelement/merge approach on the original Epub3 file to transform it into a final PDF "camera ready" version for submission to KDP. I think that combining this with some simple JS for the footer will allow me to use (after at most minor edit for the front matter page numbers) the printable TOC generated by Calibre. This gives me a controlled repeatable methodology that I can just turn the crank on as necessary to tune the final output.

Trying to flog the entire Epub3 document into just the right format by means of the conversion process may be an interesting challenge, but I think I'm over it at this point.
ghmerrill is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pdf (with page numbers) to epub crill Workshop 13 01-12-2019 09:13 AM
Removing page footers and numbers [PDF 2 EPUB] Radium Conversion 7 06-15-2014 08:36 AM
What Happens to Page Numbers and Breaks With Conversion to EPUB eurasiarc Conversion 0 09-26-2013 04:20 PM
PDF to EPUB conversion results in numbers at the end of each line godinpain Conversion 0 09-04-2013 10:12 AM
Calibre getting page numbers wrong in conversion to epub. WendyH Conversion 9 09-04-2011 05:29 AM


All times are GMT -4. The time now is 04:25 AM.


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