Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-10-2011, 04:42 PM   #1
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,988
Karma: 1285294
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
@page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; }

most - maybe all of my ebook conversions contain this line, before the html body
@page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; }

is it put there by calibre ?

does it do what I think it does - i.e. force a top & bottom margin- if so can I override it with the extra CSS option rather than edit each books contents, so that I have no wasted white space at top / bottom when converted for Kindle ?, or is there a better way to countermand it please ?

PS - google found me this, in an old thread- does calibre still have no override or workaround ?

"Ah, the real problem here is one of calibre's slightly annoying quirks.

Calibre places an @page rule in the header of each html file, and this overrides any @page rule in the css.

The solution is to edit all your html files and remove the style that calibre has inserted at the top. It will look like this:

<style type="text/css">
@page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; }</style>

Once this has gone, then you can control the top and bottom margins from the @page rule in the css file."

PPS I read elsewhere that Kindle ignores or does not support bottom margin - it that's true , then this becomes a question only about controlling top margin,
also ( running out of PPPS's here ) googling "@page rule" suggests that it only applies to printed paginated media, so what is the code for in an .epub ?, and is messing with it a pointless exercise for books destined for e-readers?

Last edited by cybmole; 02-10-2011 at 04:54 PM.
cybmole is offline   Reply With Quote
Old 02-10-2011, 05:21 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: 26,438
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It's there for those epub readers that support top and bottom margins and you can control it via the page setup options under conversion settings.
kovidgoyal is offline   Reply With Quote
Old 02-11-2011, 02:18 AM   #3
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,988
Karma: 1285294
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
ok - so you're saying that values specified on the pages setup screen generate the margin top & bottom values in the @page code ?. makes sense, but how come then, that margin left, margin right elements are not also present in the @page line ( as all the page setup defaults are 5pts ? )

I can't view converted .mobi code, but does calibre add a similar @page line to its mobi output, or is this an epub-specific thing ?

last Q: where would I find more info on which epub readers that support top and bottom margins. my son has a sony 350 - does that ?
cybmole is offline   Reply With Quote
Old 02-11-2011, 06:55 AM   #4
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 667
Karma: 436517
Join Date: Jul 2010
Location: UK
Device: PRS-300 (R.I.P.), PW2, Nexus7
It would be useful to have an option to switch off this @page per html file. Then any @page specified in the stylesheet would automatically apply to all pages. I use an entry in my CSS with units of "px" which means I then have to regex out all the @page blocks which calibre has inserted into the html files.

My Sony reader, (PRS-300), supports @page, so maybe all Sony readers do.

Last edited by Agama; 02-11-2011 at 06:58 AM.
Agama is offline   Reply With Quote
Old 02-11-2011, 07:04 AM   #5
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,988
Karma: 1285294
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
Quote:
Originally Posted by Agama View Post
It would be useful to have an option to switch off this @page per html file. Then any @page specified in the stylesheet would automatically apply to all pages. I use an entry in my CSS with units of "px" which means I then have to regex out all the @page blocks which calibre has inserted into the html files.

My Sony reader, (PRS-300), supports @page, so maybe all Sony readers do.
if I have understood Kovid correctly, you can remove it by setting zero values on the page setup options then converting epub to epub - I have not tested that, but if it works it would be faster than regex page by page.

i don't get the design logic though - why does calibre add it to each html file rather than set it once, globally in css ?
cybmole is offline   Reply With Quote
Old 02-11-2011, 11:37 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: 26,438
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by cybmole View Post

i don't get the design logic though - why does calibre add it to each html file rather than set it once, globally in css ?
Because different pages can sometimes need different margins. Think of dedication pages or other head matter.
kovidgoyal is offline   Reply With Quote
Old 02-11-2011, 01:47 PM   #7
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 2,913
Karma: 4329601
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O
Quote:
Originally Posted by kovidgoyal View Post
Because different pages can sometimes need different margins. Think of dedication pages or other head matter.
Interesting. I have also always wondered why the @page info is in each html file. Most of the non-calibre-created epubs I've needed to tweak seem to just use different css classes for special pages such as front and back matter.
jackie_w is online now   Reply With Quote
Old 02-11-2011, 04:15 PM   #8
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: 26,438
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by jackie_w View Post
Interesting. I have also always wondered why the @page info is in each html file. Most of the non-calibre-created epubs I've needed to tweak seem to just use different css classes for special pages such as front and back matter.
You cannot use a CSS class for an @page rule as far as I know. And setting a top and bottom margin on body is pointless since you want the margins on each screenful of text, bot just the start and end.
kovidgoyal is offline   Reply With Quote
Old 02-11-2011, 04:34 PM   #9
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 2,913
Karma: 4329601
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O
Perhaps I wasn't as clear as I could have been. Most of the epubs I've looked at haven't used @page at all, they've used CSS to force a new page and then applied a large margin-top to the first paragraph. A lot of frontmatter is a bunch of individual single pages. Mind you I mainly read novels.

Last edited by jackie_w; 02-11-2011 at 04:38 PM.
jackie_w is online now   Reply With Quote
Old 02-11-2011, 04:40 PM   #10
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: 26,438
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Ah, well calibre's strategy is a lot more flexible.
kovidgoyal is offline   Reply With Quote
Old 02-11-2011, 05:32 PM   #11
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,988
Karma: 1285294
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
Quote:
Originally Posted by kovidgoyal View Post
Because different pages can sometimes need different margins. Think of dedication pages or other head matter.
ok - so you could manually edit the @page values for specific parts of a book after calibre has added them e.g. by editing the epub with sigil.

but next time you run the book through calibre - say to get a .mobi version - it's going to re-insert the default code into every file ?

or am I misunderstanding, still ?

( I did partially test this - I removed all the @page stuff from a book with sigil , saved , then re-converted epub to epub with calbre , & saw that it has all been put back again. i did epub to epub to that I could re-examine the output file code. For real, I'd be wanting to do e-pub to mobi. I did not test the effect of altering some of the margin values in some of the files only though )
cybmole is offline   Reply With Quote
Old 02-11-2011, 05:33 PM   #12
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: 26,438
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
MOBI does not support top and bottom margins.
kovidgoyal is offline   Reply With Quote
Old 02-11-2011, 05:39 PM   #13
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,988
Karma: 1285294
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
Quote:
Originally Posted by kovidgoyal View Post
MOBI does not support top and bottom margins.
Hmm- well Kindle mobi does in that I can go to an epub css, add top / bottom margins to any of the .calibre styles, and those changes will show up after converting to mobi & sending to Kindle - the ignore margins option in Kindle output does not negate those

e.g. these margin top settings ( from an actual epub book) both work OK in that I can see them being applied within the Kindle display.
Code:
calibre14 {
    display: block;
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
    margin-top: 1em;
    text-align: justify;
    text-indent: 0
    }
.calibre15 {
    display: block;
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
    margin-top: 11pt;
    text-align: justify;
    text-indent: 0
    }
so top / bottom is supported at a paragraph / style level. do you mean it is not supported at a @page level ?
cybmole is offline   Reply With Quote
Old 02-12-2011, 12:54 AM   #14
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,908
Karma: 12755553
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by cybmole View Post
do you mean it is not supported at a @page level?
Not only is that what he means but that is what he stated throughout this thread.
DoctorOhh is offline   Reply With Quote
Old 02-12-2011, 07:38 AM   #15
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 667
Karma: 436517
Join Date: Jul 2010
Location: UK
Device: PRS-300 (R.I.P.), PW2, Nexus7
Quote:
Originally Posted by cybmole View Post
if I have understood Kovid correctly, you can remove it by setting zero values on the page setup options then converting epub to epub - I have not tested that, but if it works it would be faster than regex page by page.
Unfortunately not, it doesn't actually remove the @page data. Calibre simply adds @page { margin-bottom: 0.000000pt; margin-top: 0.000000pt; } to every file.
Agama is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
anyway to change Kindle top/bottom margin? cdpango Kindle Developer's Corner 2 11-28-2010 09:20 PM
larger top page margin when printing to pdf? whbenson Sigil 0 05-15-2010 01:38 AM
little issue converting from odt to epub (top and bottom margin) superanima Calibre 1 02-15-2010 05:15 PM
Can't get rid of bottom margin in epubs ShellShock Sony Reader 3 02-11-2010 05:15 PM
calibre ignore margin-top and margin-bottom bender Calibre 2 12-11-2009 07:58 AM


All times are GMT -4. The time now is 10:23 PM.


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