12-02-2020, 01:22 PM | #1 |
Connoisseur
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. |
12-02-2020, 02:09 PM | #2 |
creator of calibre
Posts: 43,966
Karma: 22669822
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
|
Advert | |
|
12-02-2020, 02:35 PM | #3 |
Connoisseur
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. |
12-02-2020, 09:36 PM | #4 |
Connoisseur
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. |
12-02-2020, 10:34 PM | #5 |
creator of calibre
Posts: 43,966
Karma: 22669822
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.
|
Advert | |
|
12-02-2020, 11:23 PM | #6 |
Connoisseur
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. |
12-03-2020, 12:09 AM | #7 |
creator of calibre
Posts: 43,966
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
All available variables are documented.
|
12-03-2020, 08:09 AM | #8 |
Connoisseur
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.
|
12-03-2020, 08:11 AM | #9 | |
Grand Sorcerer
Posts: 6,543
Karma: 84810789
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
|
Quote:
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. |
|
12-03-2020, 08:20 AM | #10 | |
Connoisseur
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
|
Quote:
|
|
12-03-2020, 08:29 AM | #11 |
Grand Sorcerer
Posts: 6,543
Karma: 84810789
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
|
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.
|
12-03-2020, 08:42 AM | #12 |
Connoisseur
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.
|
12-03-2020, 09:25 AM | #13 |
creator of calibre
Posts: 43,966
Karma: 22669822
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.
|
12-03-2020, 09:44 AM | #14 | |
Connoisseur
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
|
Quote:
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. |
|
|
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 |