01-04-2015, 12:39 AM | #1 |
Addict
Posts: 229
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
|
ePub->pdf: How to narrow space between header and book text?
First, I found that 2.15 almost perfectly converts my ePubs to pdf for reading on my Kindle Paperwhite 2013. I created html template that squeezes author, title, page number, and section into the header: Author and title go to even page, section and page number go to odd page. Template also draws a separation line under the header:
Code:
<div style="font-size:x-small"> <span class="even_page"><p style="float:left">_AUTHOR_</p> <p style="float:right">_TITLE_</p><span><hr width="100%"> </div> <div style="font-size:x-small"> <span class="odd_page"><p style="float:left">_SECTION_</p> <p style="float:right">_PAGENUM_</p><span><hr width="100%"> </div> Unfortunately, one issue rains of my parade: Excessively wide space between header and book text. This space is present even if I don't draw separation line, it always steals at least one line of text from the page top. My question is: Are there any means to decrease space between header and text? Last edited by EbokJunkie; 01-04-2015 at 12:45 AM. |
01-04-2015, 12:47 AM | #2 |
Grand Sorcerer
Posts: 5,659
Karma: 66420972
Join Date: Dec 2011
Location: Australia
Device: Kobo Libra 2, iPadMini4, iPad4, MBP; support other Kobo/Kindles
|
Stop converting to PDF and let Calibre auto-convert to azw3 instead.
Sorry, I know this doesn't specifically answer your question. But you have a reader that reflows and resizes text in useful and somewhat customisable ways, and a format that converts seamlessly to a format usable by your Kindle - why hobble it by converting to a printed-page-layout format that introduces all sorts of difficulties? |
Advert | |
|
01-04-2015, 01:11 AM | #3 |
Addict
Posts: 229
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
|
@meeera
pdf is absolutely perfect format for reading on Kindle Paperwite/Voyage - if conversion is implemented specifically for correct page size, convenient font size and weight, right side margins etc. Kindle Paperwhite/Voyage allow to control text contrast from lightest to darkest, option unavailable for azw3. Headers/footers make e-reader page look similar to traditional paper book page. I also noticed that my favorite Helvetica Neue looks prettier in pdf format than in azw3. Pdf also deserves more attention being an universal format that works on all modern reading devices. It just needs some TLC from developers and users. |
01-04-2015, 01:14 AM | #4 |
creator of calibre
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
decrease page margins in the page layout section and set the margins/padding for the html elements in your template to zero
|
01-04-2015, 11:52 AM | #5 | |
Addict
Posts: 229
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
|
Quote:
Code:
<div style="font-size:x-small;" > <span class="even_page"> <p style="float:left;margin-top:0px;margin-bottom:0px; padding-top:0px;padding-bottom:0px;border-width:0px;" >_AUTHOR_</p> <p style="float:right;margin-top:0px;margin-bottom:0px; padding-top:0px;padding-bottom:0px;border-width:0px;">_TITLE_</p> </div> <div style="font-size:x-small;" > <span class="odd_page"> <p style="float:left;margin-top:0px;margin-bottom:0px; padding-top:0px;padding-bottom:0px;border-width:0px;">_SECTION_</p> <p style="float:right;margin-top:0px;margin-bottom:0px; padding-top:0px;padding-bottom:0px;border-width:0px;">_PAGENUM_</p> </div> <hr width="100%"> The header itself is more compact but the gap between header and text is even more distinctive. I'm out of ideas how to fill it. Last edited by EbokJunkie; 01-04-2015 at 12:32 PM. |
|
Advert | |
|
01-04-2015, 10:05 PM | #6 |
creator of calibre
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
decrease page margins in the page layout section
|
01-04-2015, 11:35 PM | #7 |
Addict
Posts: 229
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
|
All page margins are zeroes.
|
01-04-2015, 11:37 PM | #8 |
creator of calibre
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Then that is the best you can get.
|
01-05-2015, 02:01 AM | #9 |
Addict
Posts: 229
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
|
Set up an experiment.
Created a batch file and ran conversion from command line. Noticed that PDF plugin sends message to output: Top margin is too small for header, increasing it. Experimented with top margin value and found that at margin>=36 pt this message disappears. Than I commented out header option in batch file leaving top margin at 36 pt and obtained page text shifted down to exactly the same distance as it was when header was activated. May it be that Calibre overreacts to header presence and forces top margins to the value (36 pt) that exceeds actual height of the header? That could be the cause of those extra space. |
01-05-2015, 02:03 AM | #10 |
creator of calibre
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That is the cause of it and it is not going to change, as there is no easy way to determine the minimum size for the top margin that will fit the header on all the pages of the book.
|
01-06-2015, 06:45 PM | #11 |
Addict
Posts: 229
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
|
Well, found the top margin 36pt limit here:
Code:
src/calibre/ebooks/pdf/render/from_html.py Thank you for implementation this ingenious technique of adding personal hacks Just one suggestion while we are on the same page: It'd be nice to have title truncated to fit into the page width. Longer title like Through the Looking-Glass, and What Alice Found There entirely carry over to the next line so that even existing 36 pt limit might be not able to accommodate it. Last edited by EbokJunkie; 01-06-2015 at 07:20 PM. |
01-06-2015, 07:47 PM | #12 |
creator of calibre
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Use the overflow:hidden CSS property alongwith white-space: nowrap
|
01-06-2015, 07:57 PM | #13 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
In order to preserve the change, commit it and then you can update calibre with
Code:
git remote update && git rebase origin/master |
01-06-2015, 10:44 PM | #14 |
Addict
Posts: 229
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
|
@kovidgoyal
How can I add CSS properties to html template? Whatever I try, I'm getting errors. |
01-06-2015, 10:51 PM | #15 |
creator of calibre
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
style="overflow:hidden; white-space: nowrap"
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Narrow text width, double spacing | R71986 | Conversion | 12 | 06-20-2014 12:20 PM |
Generate epub using text-recognized text in PDF not Pictures. | lordofazeroth | Conversion | 0 | 09-19-2013 04:16 PM |
Narrow No-Break Space display | roger64 | Sigil | 6 | 12-20-2012 02:43 PM |
Narrow No-Break Space and commercial support. | roger64 | ePub | 8 | 09-04-2012 01:08 PM |
PDF Conversion - Removing Header / Footer Text | heb | Sony Reader | 9 | 07-11-2010 11:02 PM |