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 01-25-2022, 05:10 PM   #1
porphyry5
Connoisseur
porphyry5 began at the beginning.
 
Posts: 69
Karma: 10
Join Date: Apr 2013
Device: Kobo Clara, Onyx Boox Monte Cristo
Alternative to "class=chapter" to force a page break

I produce epubs from a single (deprecated) html source file with calibre. The only way I know to produce a forced page break in my kobo and onyx ereaders is by adding the phrase " class=chapter" to specific html tags, for example:
Code:
<html><body>
<p class=chapter><img width=100% src=i/1000.jpg></p> 
<p class=chapter><img width=100% src=i/1001.jpg></p> 
<a name="c/1004.tiff"></a> 
<h3 class=chapter>Foreword</h3>
This does the job very well, except the two <img...> lines appear in the Table of Contents as 'Unknown' chapters, which I would prefer to do without. Does calibre have an alternative to "class=chapter" that will cause it to generate page break without affecting the TOC?
porphyry5 is offline   Reply With Quote
Old 01-25-2022, 05:32 PM   #2
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,351
Karma: 6794938
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Split your single html source into separate html pages. Each html page forces a new page/chapter.
Karellen is online now   Reply With Quote
Old 01-25-2022, 09:06 PM   #3
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,440
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Class=chapter is a crude way to do it. Actually the word Chapter is a keyword

What that was included in conversion for was for older text files that had no HTML.

Just break the files 'per chapter'

or use the CSS page-break-before: always; attached to the first block where you want a split
theducks is online now   Reply With Quote
Old 01-25-2022, 09:45 PM   #4
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: 44,482
Karma: 24495778
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Or use the option in the structure detection section of the conversion dialog (which is also where class="chapter" comes from btw)
kovidgoyal is offline   Reply With Quote
Old 01-27-2022, 05:15 PM   #5
porphyry5
Connoisseur
porphyry5 began at the beginning.
 
Posts: 69
Karma: 10
Join Date: Apr 2013
Device: Kobo Clara, Onyx Boox Monte Cristo
Quote:
Originally Posted by Karellen View Post
Split your single html source into separate html pages. Each html page forces a new page/chapter.

Thank you for the suggestion, but I would prefer to avoid generating multiple sources if possible. I produce epubs by the use of a series of bash and vim scripts from original screenshot images. Writing code is much simplified if I only ever have to consider one input file with a constant name, which is how I have it arranged.
porphyry5 is offline   Reply With Quote
Old 01-27-2022, 05:41 PM   #6
porphyry5
Connoisseur
porphyry5 began at the beginning.
 
Posts: 69
Karma: 10
Join Date: Apr 2013
Device: Kobo Clara, Onyx Boox Monte Cristo
Quote:
Originally Posted by theducks View Post
Class=chapter is a crude way to do it. Actually the word Chapter is a keyword
Au contraire, it is an extremely refined way of doing it, because it may be applied, or not as one chooses, to so many instances where the keyword 'chapter' is unavailable, e.g. Foreword, Preface, Author's Note, Glossary, Epilog etc, even to books that indicate chapters by such formatting "subtleties" as capitalizing the first line or first few words of each chapter; all this merely by coding a regex that fits the peculiarities of the text involved to control a script that codes the chapter heading for each such found in the text. Really the only limit to it is one's imagination.

Quote:
or use the CSS page-break-before: always; attached to the first block where you want a split
I've tried that via the html 'style' tag, but it does not produce the desired effect. I've never learned CSS because my interest in page formatting is minimal, I find calibre's vanilla option completely satisfactory in that respect.

But thank you for your help.
porphyry5 is offline   Reply With Quote
Old 01-27-2022, 06:10 PM   #7
porphyry5
Connoisseur
porphyry5 began at the beginning.
 
Posts: 69
Karma: 10
Join Date: Apr 2013
Device: Kobo Clara, Onyx Boox Monte Cristo
Quote:
Originally Posted by kovidgoyal View Post
Or use the option in the structure detection section of the conversion dialog (which is also where class="chapter" comes from btw)
Perfect.
Quote:
The default setting for detecting page breaks is:

//*[name()='h1' or name()='h2']

which means that calibre will insert page breaks before every <h1> and
<h2> tag by default.
Meant all I needed to do was
Code:
<h2><img width=100% src=i/1000.jpg></h2> 
<h2><img width=100% src=i/1001.jpg></h2>
And thank you for your courtesy, eschewing the use of RTFM, which I certainly should have done.
porphyry5 is offline   Reply With Quote
Reply

Tags
calibre, html, page breaks


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Class action: "sale" royalties on "licensed" ebooks drjenkins News 2 06-02-2016 08:44 AM
1st page replaced by blank "Chapter 1" page tone-alone Calibre 1 07-12-2014 02:58 PM
iPad "page-break-after: avoid" not supports in Ipad. Sushil Apple Devices 0 01-12-2012 05:14 AM
inserting a "ruled Line" /chapter and page breaks tscamera Calibre 3 01-05-2011 04:47 PM


All times are GMT -4. The time now is 09:04 PM.


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