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 01-04-2015, 12:39 AM   #1
EbokJunkie
Addict
EbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blue
 
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>
I'm also happy with Calibre ability to provide hyphens in pdf if source ePub carries properly distributed soft hyphens (see attached PW2 screenshots).

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?
Attached Thumbnails
Click image for larger version

Name:	even_page.png
Views:	337
Size:	154.4 KB
ID:	133272   Click image for larger version

Name:	odd_page.png
Views:	289
Size:	57.1 KB
ID:	133273   Click image for larger version

Name:	hyphens.png
Views:	279
Size:	56.3 KB
ID:	133275  

Last edited by EbokJunkie; 01-04-2015 at 12:45 AM.
EbokJunkie is offline   Reply With Quote
Old 01-04-2015, 12:47 AM   #2
meeera
Grand Sorcerer
meeera ought to be getting tired of karma fortunes by now.meeera ought to be getting tired of karma fortunes by now.meeera ought to be getting tired of karma fortunes by now.meeera ought to be getting tired of karma fortunes by now.meeera ought to be getting tired of karma fortunes by now.meeera ought to be getting tired of karma fortunes by now.meeera ought to be getting tired of karma fortunes by now.meeera ought to be getting tired of karma fortunes by now.meeera ought to be getting tired of karma fortunes by now.meeera ought to be getting tired of karma fortunes by now.meeera ought to be getting tired of karma fortunes by now.
 
meeera's Avatar
 
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?
meeera is offline   Reply With Quote
Advert
Old 01-04-2015, 01:11 AM   #3
EbokJunkie
Addict
EbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blue
 
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.
EbokJunkie is offline   Reply With Quote
Old 01-04-2015, 01:14 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,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
kovidgoyal is offline   Reply With Quote
Old 01-04-2015, 11:52 AM   #5
EbokJunkie
Addict
EbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blue
 
Posts: 229
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
Quote:
Originally Posted by kovidgoyal View Post
decrease page margins in the page layout section and set the margins/padding for the html elements in your template to zero
Thanks, I tried as I could
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%">
but result is not very satisfactory (see attached).

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.
Attached Thumbnails
Click image for larger version

Name:	zero_html_margins.png
Views:	264
Size:	57.2 KB
ID:	133293  

Last edited by EbokJunkie; 01-04-2015 at 12:32 PM.
EbokJunkie is offline   Reply With Quote
Advert
Old 01-04-2015, 10:05 PM   #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,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
decrease page margins in the page layout section
kovidgoyal is offline   Reply With Quote
Old 01-04-2015, 11:35 PM   #7
EbokJunkie
Addict
EbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blue
 
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.
EbokJunkie is offline   Reply With Quote
Old 01-04-2015, 11:37 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: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Then that is the best you can get.
kovidgoyal is offline   Reply With Quote
Old 01-05-2015, 02:01 AM   #9
EbokJunkie
Addict
EbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blue
 
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.
EbokJunkie is offline   Reply With Quote
Old 01-05-2015, 02:03 AM   #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: 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.
kovidgoyal is offline   Reply With Quote
Old 01-06-2015, 06:45 PM   #11
EbokJunkie
Addict
EbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blue
 
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
set min_margin to 15, set Windows development environment and got perfect results.
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.
Attached Thumbnails
Click image for larger version

Name:	15pt_margin_limit.png
Views:	233
Size:	148.8 KB
ID:	133475  

Last edited by EbokJunkie; 01-06-2015 at 07:20 PM.
EbokJunkie is offline   Reply With Quote
Old 01-06-2015, 07:47 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: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Use the overflow:hidden CSS property alongwith white-space: nowrap
kovidgoyal is offline   Reply With Quote
Old 01-06-2015, 07:57 PM   #13
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
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
Much easier than applying the change each time you reset from upstream, unless you don't update weekly I guess.
eschwartz is offline   Reply With Quote
Old 01-06-2015, 10:44 PM   #14
EbokJunkie
Addict
EbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blue
 
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.
EbokJunkie is offline   Reply With Quote
Old 01-06-2015, 10:51 PM   #15
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,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
style="overflow:hidden; white-space: nowrap"
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 02:30 PM.


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