07-24-2012, 07:23 AM | #1 |
Wizard
Posts: 1,775
Karma: 2694823
Join Date: Dec 2011
Location: The Netherlands
Device: Kobo Touch, Glo, Clara HD
|
Custom code in ePub titlepage.xhtml
Does anyone know if there's a way to have Calibre put different size values in the titlepage for the cover, when converting to ePub?
I have a Kobo Touch which listens to the values in the titlepage.xhtml when displaying the cover... unfortunately Calibre puts the following in the body: Code:
<image height="684" width="512" xlink:href="../Images/cover.jpeg"></image> So I'd like to tell Calibre to put either no size in at all, or 800 x 600, when converting to ePub. That way I can correct the cover sizes of all my ePubs in one go. Any genius ideas on how to do this? |
07-24-2012, 09:44 AM | #2 | |
Wizard
Posts: 2,018
Karma: 13471689
Join Date: Oct 2007
Location: Almere, The Netherlands
Device: Kobo Sage
|
Quote:
Haven't tried it, though. |
|
Advert | |
|
07-24-2012, 10:05 AM | #3 |
Wizard
Posts: 2,082
Karma: 8796704
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
|
Try under covert--epub output checking Preserve cover aspect ratio.
bernie |
07-24-2012, 11:10 AM | #4 | |
Wizard
Posts: 1,775
Karma: 2694823
Join Date: Dec 2011
Location: The Netherlands
Device: Kobo Touch, Glo, Clara HD
|
Quote:
Very weird that the Kobo reader's profile is set to put wrong dimensions in... EDIT: Except that it doesn't work, see my next post. Thanks bernie, I tried that before. What it does is indeed preserve the aspect ratio, but not the exact number of pixels. So for instance, it will set the size to 512x648... And my Kobo makes the image that size, leaving the left over pixels blank. Last edited by Mrs_Often; 07-24-2012 at 11:22 AM. |
|
07-24-2012, 11:25 AM | #5 |
Wizard
Posts: 1,775
Karma: 2694823
Join Date: Dec 2011
Location: The Netherlands
Device: Kobo Touch, Glo, Clara HD
|
I spoke too soon, it doesn't work. But I really don't understand why not. The code Calibre puts in the titlepage.xhtml is:
Code:
<?xml version='1.0' encoding='utf-8'?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="calibre:cover" content="true"/> <title>Cover</title> <style type="text/css" title="override_css"> @page {padding: 0pt; margin:0pt} body { text-align: center; padding:0pt; margin: 0pt; } </style> </head> <body> <div> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 600 800" preserveAspectRatio="none"> <image width="600" height="800" xlink:href="cover1.jpeg"/> </svg> </div> </body> </html> If I completely remove the size tags from that code, the cover is even worse: left margin smaller than right margin, and top and bottom margins too! The following code does work, but I have to put that in manually. I really can't see anything in the above code that would mess the cover up... Code:
<?xml version="1.0" encoding="utf-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <style type="text/css"> /*<![CDATA[*/ body.sgc-1 {margin: 0px; text-align: center;} /*]]>*/ </style> </head> <body class="sgc-1"> <div><img alt="" src="cover1.jpeg" /></div> </body> </html> Last edited by Mrs_Often; 07-24-2012 at 11:28 AM. |
Advert | |
|
07-24-2012, 12:04 PM | #6 |
Resident Curmudgeon
Posts: 73,975
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
The way it's supposed to work is that titlepage.xhtml has the values for the dimensions for the cover image. Then if you care about how it looks, you have the aspect ratio correct. So the cover image will fill the screen top to bottom, but usually not left to right as that would make the cover image stretched and look off. So the best thing is to check that you want the aspect ratio preserved and you want to use the correct profile as a tablet profile can mess things up when the image is larger then your screen.
|
07-24-2012, 12:36 PM | #7 |
Wizard
Posts: 1,775
Karma: 2694823
Join Date: Dec 2011
Location: The Netherlands
Device: Kobo Touch, Glo, Clara HD
|
I'm not quite sure I understand what you mean JSWolf... The correct profile has never worked for me (cover always too small and aspect ratio different to the screen). The actual size of the image itself I've made sure is 600x800 pixels...
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Code which creates recipe feed xhtml? | mattst | Development | 4 | 11-02-2011 01:33 PM |
Find Dialog and XHTML Code View | jondolar | Sigil | 0 | 10-18-2011 10:16 AM |
Graphical layout vs. semantically "correct" XHTML code | Iznogood | Workshop | 16 | 04-05-2011 08:14 AM |
PRS700 just shows Titlepage in EPUB | cremofix | Calibre | 4 | 10-30-2009 01:17 PM |
xhtml from epub | georger | ePub | 8 | 10-13-2009 07:14 AM |