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 04-17-2025, 02:07 AM   #1
corban123
Junior Member
corban123 began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Apr 2025
Device: Kobo B&W
Unable to get page break to apply properly on an EPUB

Hey everybody,

I'm currently attempting to go from PDF -> EPUB -> EPUB, where I'm able to capture the large titles within the PDF and convert those into page breaks.
Despite my best attempts, I am consistently unable to get the page breaks to to be generated, and I'm curious if somebody may know whether or not I'm making an obvious mistake.

So the current idea was to convert the PDF -> EPUB with no page break settings, and then converting that new EPUB into a second EPUB with the page break adds since the formatting would be more consistent.

The area looks like

Code:
<p class="calibre1"><i class="calibre4">Blah blah blah ^ ^;</i></p>
<p class="calibre1"><span class="calibre2">557. Episode 2. Rewrite (2)</span></p>
<p class="calibre1">Blah blah blah blah</p>
with the XPath being
Code:
//p[re:test(span[@class='calibre2'], '.*episode.*', 'i')]
.
such that it'll page break before the `episode 557`.
Even attempting to manually put in 557 instead of `.*episode.*` doesn't seem to cause the page break to be created.

Thanks for any help you may be able to provide!
corban123 is offline   Reply With Quote
Old 04-17-2025, 05:12 AM   #2
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 14,010
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
1. PDF is really only to view or print. Try fixing it in MS Word or LO Writer (extra Save As in Docx for conversion). Usually attempting to convert to epub is a failure.

2. The 100% way to have a page break is a new HTML file. That can be done manually or searching for suitable text and adding <h tags in the editor via regex search & replace <h2>Episode 2</h2>
Then Editor split feature on h2

Forget direct conversion of PDF.
Quoth is offline   Reply With Quote
Advert
Old 04-17-2025, 05:15 AM   #3
corban123
Junior Member
corban123 began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Apr 2025
Device: Kobo B&W
Yeah at the moment, the main change is to go from EPUB - > EPUB. That's why I'm able to get the above html. Is the regex I provided wrong for the epub?
corban123 is offline   Reply With Quote
Old 04-17-2025, 09:36 AM   #4
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: 13,457
Karma: 239219453
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
If you want to use a p tag for chapter headings instead of h, then specify in the css that the page must break before that tag. For example:

.calibre11 {
page-break-before: always}
Sirtel is offline   Reply With Quote
Old 04-17-2025, 09:49 AM   #5
gbm
Wizard
gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.
 
Posts: 2,182
Karma: 8888888
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
The easiest way to do what you want is to convert the PDF to an epub with one big html file,then use the editor split funtion at your chapter heading.

bernie

Quote:
Originally Posted by corban123 View Post
Hey everybody,

I'm currently attempting to go from PDF -> EPUB -> EPUB, where I'm able to capture the large titles within the PDF and convert those into page breaks.
Despite my best attempts, I am consistently unable to get the page breaks to to be generated, and I'm curious if somebody may know whether or not I'm making an obvious mistake.

So the current idea was to convert the PDF -> EPUB with no page break settings, and then converting that new EPUB into a second EPUB with the page break adds since the formatting would be more consistent.

The area looks like

Code:
<p class="calibre1"><i class="calibre4">Blah blah blah ^ ^;</i></p>
<p class="calibre1"><span class="calibre2">557. Episode 2. Rewrite (2)</span></p>
<p class="calibre1">Blah blah blah blah</p>
with the XPath being
Code:
//p[re:test(span[@class='calibre2'], '.*episode.*', 'i')]
.
such that it'll page break before the `episode 557`.
Even attempting to manually put in 557 instead of `.*episode.*` doesn't seem to cause the page break to be created.

Thanks for any help you may be able to provide!
gbm is offline   Reply With Quote
Advert
Old 04-17-2025, 01:38 PM   #6
corban123
Junior Member
corban123 began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Apr 2025
Device: Kobo B&W
Quote:
Originally Posted by gbm View Post
The easiest way to do what you want is to convert the PDF to an epub with one big html file,then use the editor split funtion at your chapter heading.

bernie
Hey there Bernie,

I actually have already converted it to an EPUB, and oh hey, I didn't realize there was a splitter function in the editor, fantastic! You wouldn't happen to have a feel for if there's a way to automate this would you during the conversion process would you?
corban123 is offline   Reply With Quote
Old 04-17-2025, 03:33 PM   #7
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: 13,457
Karma: 239219453
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
Quote:
Originally Posted by corban123 View Post
Hey there Bernie,

I actually have already converted it to an EPUB, and oh hey, I didn't realize there was a splitter function in the editor, fantastic! You wouldn't happen to have a feel for if there's a way to automate this would you during the conversion process would you?
You can do it via conversion if you have inserted the page breaking code in the css - see my previous post. Then conversion will split the files.
Sirtel is offline   Reply With Quote
Old 04-17-2025, 06:10 PM   #8
corban123
Junior Member
corban123 began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Apr 2025
Device: Kobo B&W
Quote:
Originally Posted by Sirtel View Post
You can do it via conversion if you have inserted the page breaking code in the css - see my previous post. Then conversion will split the files.
Hey Siren,

From my understanding, that requires that css to already exist within the html. I'm attempting to take advantage of the `insert page breaks before:` functionality in the convert page, using the xpath expression. Do you happen to have much experience with this?
corban123 is offline   Reply With Quote
Old 04-17-2025, 06:31 PM   #9
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: 13,457
Karma: 239219453
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
Quote:
Originally Posted by corban123 View Post
Hey Siren,

From my understanding, that requires that css to already exist within the html. I'm attempting to take advantage of the `insert page breaks before:` functionality in the convert page, using the xpath expression. Do you happen to have much experience with this?
Sorry, no. I've never done it that way.
Sirtel is offline   Reply With Quote
Old 04-17-2025, 06:38 PM   #10
gbm
Wizard
gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.
 
Posts: 2,182
Karma: 8888888
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
https://manual.calibre-ebook.com/edi...ing-html-files
Quote:
You can also split a single HTML file at multiple locations automatically, by right clicking inside the file in the editor and choosing Split at multiple locations. This will allow you to easily split a large file at all heading tags or all tags having a certain class and so on.
bernie
Quote:
Originally Posted by corban123 View Post
Hey there Bernie,

I actually have already converted it to an EPUB, and oh hey, I didn't realize there was a splitter function in the editor, fantastic! You wouldn't happen to have a feel for if there's a way to automate this would you during the conversion process would you?
Attached Thumbnails
Click image for larger version

Name:	Screenshot at 2025-04-17 18-33-23.png
Views:	53
Size:	695.2 KB
ID:	215080   Click image for larger version

Name:	Screenshot at 2025-04-17 18-36-09.png
Views:	45
Size:	633.4 KB
ID:	215081  
gbm is offline   Reply With Quote
Old 04-17-2025, 06:51 PM   #11
corban123
Junior Member
corban123 began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Apr 2025
Device: Kobo B&W
Quote:
Originally Posted by gbm View Post
Thanks for this Bernie, it seems that my initial XPath expression was wrong, though I'm not completely sure why, but hey, at least I found one that kinda works. Thanks again for your help!
corban123 is offline   Reply With Quote
Old 04-17-2025, 07:36 PM   #12
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,717
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@corban - you can also split text arbitrarily in the Preview panel:

Click image for larger version

Name:	Screenshot 2025-04-18 093023.jpg
Views:	41
Size:	108.6 KB
ID:	215084

BR
BetterRed is offline   Reply With Quote
Old 04-18-2025, 06:07 AM   #13
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 14,010
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
Quote:
Originally Posted by Sirtel View Post
If you want to use a p tag for chapter headings instead of h, then specify in the css that the page must break before that tag. For example:

.calibre11 {
page-break-before: always}
That doesn't work in all apps/ereaders. A file split always works unless an app is set to scroll and have no pages.
Quoth is offline   Reply With Quote
Old 04-18-2025, 06:28 AM   #14
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: 13,457
Karma: 239219453
Join Date: Jan 2014
Location: Estonia
Device: Kobo Sage & Libra 2
Quote:
Originally Posted by Quoth View Post
That doesn't work in all apps/ereaders.
No, but then you can use conversion which will split the files as specified in the css.
Sirtel is offline   Reply With Quote
Old 04-18-2025, 07:47 AM   #15
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,736
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Sirtel View Post
If you want to use a p tag for chapter headings instead of h, then specify in the css that the page must break before that tag. For example:

.calibre11 {
page-break-before: always}
IMHO, it's better to just split the HTML where the page break is wanted.
JSWolf is offline   Reply With Quote
Reply

Tags
epub, pagebreak


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Firmware Update Kindle DX 2 G JB does not apply properly Johnny666 Amazon Kindle 6 05-12-2020 02:31 PM
page-break-before not responded to in any Epub reader ivanbayross ePub 16 01-19-2013 06:33 PM
page break in epub on iPad JoanneM ePub 3 12-07-2011 09:59 AM
mobi to epub - sections cause page break sonyreaderfan Conversion 1 12-02-2011 04:17 AM
Mobi to epub page break mr.ninja13 Calibre 23 08-09-2011 02:06 PM


All times are GMT -4. The time now is 12:02 PM.


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