![]() |
#1 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 260
Karma: 2092424
Join Date: Oct 2011
Location: Arlington, TX
Device: Kindle PW4, Moon+ Reader on a cheap Android tablet
|
epub to azw3 conversion and Extra CSS
I'm using calibre 2.18. I have recently acquired a kindle PW2 and am in the process of converting my epub library to azw3. I have been experimenting with using the "Look & Feel/Extra CSS" field to add "html { margin-left: -30px; margin-right: -30px; }" to the azw3 css, which can reduce the margins on the kindle.
In almost every epub I convert to azw3, the "Extra CSS" appears to be ignored, and does not appear anywhere in any of the css files in the output azw3. No matter what css snippet I put in the "Extra CSS" box, it does not appear anywhere in the output azw3. However, in a very few cases, something stranger heppens: 1 - A third css file - 0003.css - is produced in the output azw3 (most conversions seem to only produce 2 css files). The 0003.css file does contain the "Extra CSS" from the conversion dialog. 2 - An html table of contents page is generated as the last html/text file in the output azw3's spine. This html toc at the end of the spine is not present in the input epub and is the only html file in the azw3 that links to the 0003.css stylesheet with the "Extra CSS". None of the other html/text files in the output azw3 link to the 0003.css sheet. I guess this html toc is related to the "table of contents" settings in the conversion dialog. I've made sure I don't have anything set there and that I press the "Restore defaults" button before setting the "Extra CSS" and starting the conversion. Below is the log from a conversion that produces this extra toc. Does anyone have any idea what's going on here? Spoiler:
|
![]() |
![]() |
![]() |
#2 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,171
Karma: 8800000
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
|
Quote:
Code:
body { margin-left: -30px; margin-right: -30px; } bernie |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 260
Karma: 2092424
Join Date: Oct 2011
Location: Arlington, TX
Device: Kindle PW4, Moon+ Reader on a cheap Android tablet
|
I've tried other css there - no matter what, it doesn't seem to make into the css of the converted azw3.
I can get around it using the calibre editor afterwards to put it in the css manually, but it would be more convenient to get the css updated as part of the conversion. |
![]() |
![]() |
![]() |
#4 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,171
Karma: 8800000
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
|
Quote:
bernie Do a search I think I remember somebody doing this. |
|
![]() |
![]() |
![]() |
#5 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 260
Karma: 2092424
Join Date: Oct 2011
Location: Arlington, TX
Device: Kindle PW4, Moon+ Reader on a cheap Android tablet
|
The specific css and margins are not my issue here. That css was just an illustration.
My issue is that regardless of the css snippet I put in the "Extra CSS" tab of the conversion dialog, it either does not appear at all in the css of the converted azw3, or it is in a css file that is linked by only one html file (the last) and has no effect on the rest of the book. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,198
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Extra css is not going to work for body/html margins. Those are controlled by the page layout section of the conversion dialog.
As for allowing negative margins there, it's not going to happen, negative values are already used to signify that conversion should not set any values at all. Negative margins are not a sufficiently widespread use case to merit changing that. You'll have to stick to modifying them by hand, post conversion. |
![]() |
![]() |
![]() |
#7 | |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,198
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
And also remember that conversion flattens css, so you will not see your unmodified css anywhere, it will have been split up and distributed into the various classes. |
|
![]() |
![]() |
![]() |
#8 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 260
Karma: 2092424
Join Date: Oct 2011
Location: Arlington, TX
Device: Kindle PW4, Moon+ Reader on a cheap Android tablet
|
Ok - as a random example, I downloaded this epub from the MR library: https://www.mobileread.com/forums/sho...d.php?t=251459 and imported it into calibre.
Then: open the conversion dialog, set output format to azw3, click "restore defaults", and in Look & Feel, I enter Quote:
When I open the converted azw3 in the calibre editor, I see that the last html file in the "Text" files is a table of contents that isn't there at the end of the epub. The Extra CSS I entered above is in the 0003.css file. The 0003.css file is linked only by this final html toc file, so doesn't have any affect on the rest of the book. Is this normal? Am I doing something wrong here? |
|
![]() |
![]() |
![]() |
#9 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 260
Karma: 2092424
Join Date: Oct 2011
Location: Arlington, TX
Device: Kindle PW4, Moon+ Reader on a cheap Android tablet
|
Ok - I figured out that if I check "Do not add table of contents" in the Azw3 output tab of the dialog, that final html toc isn't generated.
This looks like it's more complex that what I was assuming. All I need is for whatever gibberish I put in the Extra CSS of the conversion options to end up in the azw3's css. Specifically, if I set negative margins in the css "html {}" selector, it appears to override all other margins (body, @page, paragraph, etc) and just works in the PW2. I can easily paste this in from the calibre editor. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
conversion to .azw3, epub as source? | Freeballer | Conversion | 4 | 05-08-2014 11:34 PM |
AZW3 to EPUB Conversion Probs | grizedale | Conversion | 4 | 04-16-2013 06:47 PM |
Epub to AZW3: css formatting not showing | topquark | Conversion | 1 | 03-20-2013 12:21 AM |
Conversion from epub to azw3 | Joy736 | Conversion | 12 | 01-01-2013 11:00 AM |
html to epub conversion with extra CSS | oilizer | Conversion | 4 | 10-23-2011 08:51 AM |