View Single Post
Old 06-21-2011, 09:23 PM   #144
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Calibre's preferences are hard-coded to pts.

If you want no margins in @page or body, then set your calibre preferences under 'page setup' in common conversion options to have all the margins zero - this will cause the plugin to work exactly as the initial implementation I posted did - any margins in @page or body will simply be deleted.

Otherwise, the plugin will delete all existing margins in body or @page, and then replaces them with the pt based margins specified in Calbre's preferences. It only puts the new margin settings in @page, so all margins set on body are always removed.

Capnm is correct in the extremely rare case that the epub css has multiple @page statements, some using 'ID', they will all be re-written, but any using an ID will just have them removed. I'm actually inclined to think that @page statements with an ID is invalid css anyway, but we'll see if someone else can provide some further enlightenment on that point. @page statements using a psuedo selector like :first would actually be ignored.

@JSWolf, I chose to put them in @page because this is the advice I've read from epub guru's like pdurrant, Kovid, and Jelby. I believe @page is more focused on device page boundaries vs. the entire text, which is what body will do. I would have liked to be able to research it more, but try googling @page - big fail. Removing the xpgt file entirely is a bit outside of the scope of this plugin, as it's focused on non/minimally-destructive changes. As Jelby has pointed out in the epub sub-forum, there are some potentially good uses for it, such as detecting whether ADE is the renderer and creating some work-around css styles that only it will render.

Edit - one last point I didn't see - if you don't like Calibre specifying top and bottom margins, simply set those to zero under page setup. That should eliminate them during conversions and with this plugin.

Last edited by ldolse; 06-21-2011 at 09:53 PM.
ldolse is offline   Reply With Quote