![]() |
#1 |
Member
![]() Posts: 10
Karma: 10
Join Date: Mar 2013
Device: kindle paperwhite
|
Conversion Problems from HTML to AZW3
I am trying to convert an HTML file to AZW3 format so to read it on my kindle paperwhite.
Here is an HTML sample. Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>TEST</title> </head> <style> body { margin:0; padding:0; color:#000; font-family:Arial, Helvetica, sans-serif; font-size:11.5pt; } .Book { margin:0cm; margin-bottom:.0001pt; text-align:center; font-size:16.0pt; font-weight:bold; page-break-before:always; page-break-after:always; } .Chapter { margin-bottom:4.0cm; text-align:center; font-size:14.0pt; font-weight:bold; page-break-before:always; } p { margin-top: 0px; margin-bottom:.0001pt; text-align:justify; text-indent:11.35pt; } </style> <body> <div class=Book>BOOK TITLE</div> <div class=Chapter>CHAPTER TITLE</div> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p> </body> </html> 1 - The calibre reader does not recognize the "margin-bottom:4.0cm;" tag. 2 - I send the converted file to the Kindle but it does not show the book. |
![]() |
![]() |
![]() |
#2 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,909
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
What is with everyone using Absolute values for normal margins? margin: 0; (used in .Book is the correct form. Zero has no units ![]() Mixed case selector names are not wrong, but you must maintain case in ALL usage. KISS |
|
![]() |
![]() |
![]() |
#3 |
Member
![]() Posts: 10
Karma: 10
Join Date: Mar 2013
Device: kindle paperwhite
|
Quotes are not requested by HTML in this case. In fact, with or without quotes you get the same result. You can try opening the HTML sent with any browser and it works even without quotes.
"margin-bottom:4.0cm;" does not work with calibre while it is repressented correctly by browsers. |
![]() |
![]() |
![]() |
#4 |
Enthusiast
![]() Posts: 27
Karma: 10
Join Date: Mar 2013
Device: none
|
You might try using "em" instead of "cm" for your margins. An "em" = 12 pts. Works for most every format.
|
![]() |
![]() |
![]() |
#5 |
Member
![]() Posts: 10
Karma: 10
Join Date: Mar 2013
Device: kindle paperwhite
|
Tried with "em". Nothing changes.
|
![]() |
![]() |
![]() |
#6 |
Enthusiast
![]() Posts: 27
Karma: 10
Join Date: Mar 2013
Device: none
|
Whoops - I failed to read part of your post.
I recall reading on another thread that AZW3 might not be supported on some devices, unless the file is downloaded from Amazon - something about the DRM code auto-embedded into AZW3, or somesuch. Maybe someone else can clarify better than I. The reason I think this may be true is that my Kindle app on my iPhone cannot read the AZW3 files that I create for my ebook. I can, however, read the files using the Kindle app on my Mac. You might be able to read the book on your Paperwhite if you convert it to MOBI instead of AZW3 in Calibre, however. Re: the margin problem, the other fix/hack I suggest trying is to enclose the offending <div> in a container with a display:block property. Seems to remedy many conversion ills for me: In between your <style></style tag>, add the following: .container { display: block } Add the corresponding HTML to your Chapter tag: <div class="container"><div class="Chapter">CHAPTER TITLE</div></div> You can use whatever you like, instead of "container." By the way, I also suggest correcting your style tag syntax to comply with standards: <style type="text/css"> And finally, you might find it helpful to run your file through the W3C Validator at http://validator.w3.org/ Good luck! |
![]() |
![]() |
![]() |
#7 |
Member
![]() Posts: 10
Karma: 10
Join Date: Mar 2013
Device: kindle paperwhite
|
thank you. I tried but it does not work. BTW, I converted other HTMLs to AZW3 without problems. My Kindle was able to recognize and show the book.
Thanks to http://validator.w3.org/ I discovered that the </head> was in the wrong position. Dreamwaver cs6 did not notice it. However, even moving it to the right position did not modify the situation. Another interesting thing is that the Code:
font-size:16.0pt; font-weight:bold; Last edited by gm139; 04-01-2013 at 03:32 AM. |
![]() |
![]() |
![]() |
#8 |
Enthusiast
![]() Posts: 27
Karma: 10
Join Date: Mar 2013
Device: none
|
Sorry my suggestions didn't work for you. I've done a little more investigating for you.
I just ran your sample through the W3 validator (after moving the </head> tag to the correct position before <body>), and it returned 3 errors. Below is a cut and paste, except that I've added these brackets [] around the portions of the tags that are displayed in RED on the results page, indicating where the error lies: ____________ Validation Output: 3 Errors Error Line 7, Column 7: required attribute "type" not specified <style[>] The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element. Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>. Error Line 49, Column 12: an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified <div class=[B]ook>BOOK TITLE</div> Error Line 51, Column 12: an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified <div class=[C]hapter>CHAPTER TITLE</div> _____________________ I added the correct type attribute to your style tag: <style type="text/css"> And enclosed your HTML class tags in quotes: <div class="Book"> <div class="Chapter"> and the sample validated perfectly. I then converted the sample to AZW3 in Calibre, and viewed it in Calibre's viewer (I don't have a Kindle). Both "Book Title" and "Chapter" are in bold. There is a 4-centimeter (1-1/2 inch) margin between "Chapter" and the latin text paragraph. So as the next thing to try, I suggest you enclose your HTML class tags attributes in straight quotes, as I did, and see if that helps. I also strongly recommend making all your measurements consistent. Use pt or em, but do it across the board. Good luck to you! |
![]() |
![]() |
![]() |
#9 |
Member
![]() Posts: 10
Karma: 10
Join Date: Mar 2013
Device: kindle paperwhite
|
Thank you for your answer.
I modified my htm sample accordingly. Here is my html code now: Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>TEST</title> <style type="text/css"> body { margin:0; padding:0; color:#000; font-family:Arial, Helvetica, sans-serif; font-size:11.5pt; } .Book { margin:0cm; margin-bottom:.0001pt; text-align:center; font-size:16.0pt; font-weight:bold; page-break-before:always; page-break-after:always; } .Chapter { margin-bottom:4.0cm; text-align:center; font-size:14.0pt; font-weight:bold; page-break-before:always; } p { margin-top: 0px; margin-bottom:0pt; text-align:justify; text-indent:15.35pt; } </style> </head> <body> <div class="Book">BOOK TITLE</div> <div class="Chapter">CHAPTER TITLE</div> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p> </body> </html> 1 - the book title is not bold 2 - there is not space between "chapter" and "p". Please, If you have time try with my code. Thank you again. |
![]() |
![]() |
![]() |
#10 | |
Enthusiast
![]() Posts: 27
Karma: 10
Join Date: Mar 2013
Device: none
|
Quote:
I've attached two screenshots - each with the Calibre viewer on the left and Kindle for Mac viewer on the right. As you can see, your code translated correctly on both. ![]() ![]() I have also attached the azw3 file that your code generated in Calibre. I hope these help! Last edited by writerkit; 04-25-2013 at 02:59 AM. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Conversion from html to azw3 does not work | gm139 | Conversion | 2 | 03-19-2013 06:32 AM |
Azw3 conversion : little picture ( vignette ) | gouni | Conversion | 2 | 03-05-2013 04:06 AM |
Conversion from epub to azw3 | Joy736 | Conversion | 12 | 01-01-2013 11:00 AM |
azw3 conversion bug? | KleineMaus | Conversion | 17 | 06-13-2012 12:00 PM |
html to epub conversion problems | DrPL | ePub | 4 | 12-22-2010 07:13 AM |