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 05-29-2013, 01:48 AM   #1
waynn
Member
waynn began at the beginning.
 
Posts: 12
Karma: 10
Join Date: May 2013
Device: Kindle
MOBI to EPUB conversion in calibre adds page breaks

I currently have this HTML that I'm passing into kindlegen to create a mobi:

Code:
<h4 id='foo' class='chapter'>Here's my heading</h4>
where the CSS for "chapter" is

Code:
page-break-before: always;
All is well and good in my MOBI, but when I convert to EPUB and then unzip the underlying EPUB (because I noticed extra page breaks), I see this.

Code:
<div class="calibre3"></div><h4 class="calibre6" id="foo">
Where calibre3 and calibre6 both have page-break-before: always set. When I preview this in iBooks, it leads to a few blank pages before hitting the chapter tag.

Is there something I can do to make sure that extra <div> isn't added? Or, alternately, is there any way I can collapse multiple empty <div> tags that have page-break-before so that there's only one page break?
waynn is offline   Reply With Quote
Old 05-29-2013, 02:14 AM   #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
Look under the structure detection section of the conversion dialog and disable all insertion of page breaks.
kovidgoyal is online now   Reply With Quote
Old 05-29-2013, 03:32 AM   #3
waynn
Member
waynn began at the beginning.
 
Posts: 12
Karma: 10
Join Date: May 2013
Device: Kindle
Hm, so in Common Options > Structure Detection I've put
Code:
/
as the XPath expression for both "Detect chapters at" and "Insert page breaks before", and I've changed "Chapter mark" to "none" but I'm still seeing the same page break. Is there another setting I'm missing?
waynn is offline   Reply With Quote
Old 05-29-2013, 03:37 AM   #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: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No that's it. With those two settings, calibre will not insert any page breaks itself. The page breaks must be present in the input document.
kovidgoyal is online now   Reply With Quote
Old 05-29-2013, 04:08 AM   #5
waynn
Member
waynn began at the beginning.
 
Posts: 12
Karma: 10
Join Date: May 2013
Device: Kindle
So I just used calibre's Tweak Book (thanks again for pointing that feature out to me) to explode the MOBI file and you're totally right -- *kindlegen* is adding a ghost <div> before the <h4> tag with page-break-before: always styling hard-coded to it. I know that's not your code but have you seen anything like that? It even turns HTML like

<h4 style="page-break-before: always">Foo bar</h4>

to

<div style="page-break-before: always"></div><h4 style="page-break-before: always">Foo bar</h4>

And when I remove that style, it just goes away completely.
waynn is offline   Reply With Quote
Old 05-29-2013, 04:12 AM   #6
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
I'm afraid the last time I used kindlegen was when I was developing KF8 support for calibre, I never use it myself. So I cant tell you anything useful about its quirks.
kovidgoyal is online now   Reply With Quote
Old 05-29-2013, 04:01 PM   #7
waynn
Member
waynn began at the beginning.
 
Posts: 12
Karma: 10
Join Date: May 2013
Device: Kindle
Actually, I just ran one more test -- I unzipped the MOBI I generated from kindlegen and see this as the HTML.

Code:
<div></div><mbp:pagebreak/><a id="filepos228387" /><h4 >
Does calibre change the imported MOBI file by adding in additional styling, and is there some setting I can change to prevent that?
waynn is offline   Reply With Quote
Old 05-29-2013, 04:19 PM   #8
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: 73,983
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Use the HTML as the source for the ePub and see what you get.
JSWolf is offline   Reply With Quote
Old 05-29-2013, 09:23 PM   #9
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
Importing books does not change them in any way whatsoever.
kovidgoyal is online now   Reply With Quote
Old 05-29-2013, 09:57 PM   #10
waynn
Member
waynn began at the beginning.
 
Posts: 12
Karma: 10
Join Date: May 2013
Device: Kindle
Hm, but it does something to change the structure -- does Tweak Book for a MOBI add a different HTML structure? Because when I use KindleUnpack, there are MOBI specific tags there that don't show up when I Explode Book in calibre.
waynn is offline   Reply With Quote
Old 05-29-2013, 10:09 PM   #11
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
Remember that MOBI generated by kindlegen actually contain two books one in MOBI6 and one in KF8. when converting/tweaking these books, calibre uses the KF8 part. You are probably looking at the MOBI6 part with KindleUnpack.
kovidgoyal is online now   Reply With Quote
Old 06-04-2013, 10:06 PM   #12
waynn
Member
waynn began at the beginning.
 
Posts: 12
Karma: 10
Join Date: May 2013
Device: Kindle
Hey Kovid,

You're totally correct! That was exactly what was happening -- I posted to the Kindle forums to ask why Kindlegen wasn't handling that correctly. Is there a way in the mean time to use the MOBI6 part of the MOBI file instead of the KF8 one?
waynn is offline   Reply With Quote
Old 06-04-2013, 10:24 PM   #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
I believe there is a kindlesplit tool floating around somewhere that can split up joint mobi files, but I've never needed to use it myself.
kovidgoyal is online now   Reply With Quote
Old 10-08-2013, 12:52 PM   #14
ajm23
Junior Member
ajm23 began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Oct 2013
Device: Kindle Fire
Trouble w/Conversion

Hi,

I imported some mobis and prcs to Calibre (which is great), and then bulk converted them all to mobi, so I may read them as "books" in my Kindle Fire. Many of the files 1) lack breaks between paragraphs, 2) lack breaks between lines of dialogue, 3) have square boxes in place of symbols, such as apostrophes. Please let me know if there is a way to bulk correct these conversion errors in Calibre.

Excuse me for tagging onto this thread, but it seemed like the most relevant one I could find.

Thank you for any inputs.

-AJM
ajm23 is offline   Reply With Quote
Old 02-13-2017, 04:09 AM   #15
ezo_58
Junior Member
ezo_58 began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Feb 2017
Device: kobo
Hi,
I know it's been many (3.75) years since anyone commented on this thread.

I had the same issue - the problem was caused by entries in the stylesheet.css - comment (/* ... */ out the lines that mention either pagebreak before or pagebreak after. Fixed for me.

Cheers

Earle
ezo_58 is offline   Reply With Quote
Reply

Tags
epub, page-break;css


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MOBI -> EPUB conversion removes scene breaks tlangner Conversion 7 01-26-2013 12:37 AM
Conversion from mobi (to mobi, or epub) breaks internal links bounder Conversion 1 10-09-2012 11:56 AM
HTML to MOBI conversion ignores page breaks LeftHanded Matt Conversion 2 12-21-2011 12:25 PM
epub to mobi h1 page breaks not starting on new page wannabee Conversion 4 08-02-2011 12:46 AM
epub to mobi loses page breaks stevent10993 Conversion 5 07-20-2011 12:43 AM


All times are GMT -4. The time now is 09:32 AM.


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