![]() |
#1 |
Member
![]() Posts: 19
Karma: 10
Join Date: Feb 2023
Device: Kobo Aura 2
|
(Solution) Formatting issues converting from azw3 to epub
Posting so if someone is looking for a solution to this problem I had, they can find this. I was not able to find an answer by searching, but I figured it out.
I was having trouble converting an azw3 to epub in Calibre. I tried a few different screen formats -- generic e-ink, generic e-ink HD, even Kindle) and in all cases, the conversion was cutting off some of the letters on the left side of some right pages. This showed up even when I opened it in an epub reader on my computer, confirming it wasn't an issue with the ereader, it was a file issue. The fix: I converted the azw3 to a mobi, confirmed there were no missing letters, deleted the azw3, and then converted the mobi to an epub. After that it was formatted properly. |
![]() |
![]() |
![]() |
#2 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 36,873
Karma: 147879470
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Did you try using the KindleUnpack plugin as an alternative to calibre's conversion?
|
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,701
Karma: 87663461
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Quote:
The Page dialog is for image resizing. Pick Tablet and images are not resized. It's a margin setting is the issue. Maybe the original has negative margins because the Kindle adds margin. That can be fixed either with kindle unpack or looking at the CSS (of azw3 or converted epub). All epub viewers/eink can put zero at the edge, so any negative margin to reduce the added margin on a real kindle will chop off parts. |
|
![]() |
![]() |
![]() |
#4 |
Member
![]() Posts: 19
Karma: 10
Join Date: Feb 2023
Device: Kobo Aura 2
|
Thank you for the suggestions! How would I go about fixing it with Kindle Unpack? I installed the plugin, unpacked the book, and noticed some oddities. Books.app said the epub was corrupted and could not be opened. Calibre's epub reader opened it up, but it retained the formatting issue where some pages were cut off at the margins. I put it on my Kobo and the poor device froze outright when I tried to move past page 2 of the book! I had to connect to my computer and delete the book to get it working again.
Or, in the convert screen, when I set the page layout to "tablet", it replicated the bug. Similarly when I set the margins to 0 to try preserving the original layout. |
![]() |
![]() |
![]() |
#5 |
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,701
Karma: 87663461
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Tablet only affects the images.
You need to look at the ebook in the Editor and open the style file (css). Setting the Margin =0 in conversion may only affect what Calibre considers to be body text. Check there are no -values in the CSS. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Member
![]() Posts: 19
Karma: 10
Join Date: Feb 2023
Device: Kobo Aura 2
|
The entirety of the az3w's css is pretty sparse, and it has no negative values.
Posted below: #data data=" @page Section1 { size:612pt 792pt; margin:36pt 72pt 72pt } div.Section1 { page:Section1 } ">#data> Those margins seem pretty big. I note that there are only 3 values in the margin, not 4, but there should be 4 margins right? (I'm not very familiar with css or html) Last edited by SillyStegosaurus; 07-25-2023 at 10:02 AM. |
![]() |
![]() |
![]() |
#7 |
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,701
Karma: 87663461
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Delete that.
Yes, there are four margins but there are various shorthand ways. I usually explicitly have four. |
![]() |
![]() |
![]() |
#8 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 74,669
Karma: 130140792
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I really dislike the margin shorthand in CSS. I prefer margins to be shown the long way with each margin on one line.
|
![]() |
![]() |
![]() |
#9 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 36,873
Karma: 147879470
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
For what it's worth, that margin shorthand is top, left and right, bottom. For a quick and dirty start, I would remove the @Page directive. Last edited by DNSB; 07-25-2023 at 12:51 PM. |
|
![]() |
![]() |
![]() |
#10 |
Member
![]() Posts: 19
Karma: 10
Join Date: Feb 2023
Device: Kobo Aura 2
|
Alright, I installed the RemoveInlineStyles plugin to Sigil and opened an epub Calibre made from the original az3w.
"This EPUB has HTML files that are not well formed or are missing a DOCTYPE, html, head or body elements. Sigil can automatically fix these files, although this may very rarely result in minor data loss in extreme circumstances. Do you want to automatically fix the files?" I had it automatically fix the files, then applied the plugin to it. According to the output, no inline styles were found at all! Checked the epub's stylesheet.css: Spoiler:
" Not really sure how to make sense of this. The epub I got from converting azw3 -> mobi -> epub is so far the only readable epub. Last edited by theducks; 07-25-2023 at 09:09 PM. Reason: Please use SPOILER |
![]() |
![]() |
![]() |
#11 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 36,873
Karma: 147879470
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
|
|
![]() |
![]() |
![]() |
#12 |
Member
![]() Posts: 19
Karma: 10
Join Date: Feb 2023
Device: Kobo Aura 2
|
KindleUnpacked to get an epub.
Opened in Sigil. Selected "no" when it asked if I wanted Sigil to automatically fix defects. Applied RemoveInlineStyles plugin. Plugin error: Incorrect XHTML/XML Detected. `Incorrect XHTML: OEBPS/Text/part0000.xhtml Line/Col 18,49 Entity 'nbsp' not declared.` The Styles/OEBPS/Styles/stylesheet.css is full of this string, " ", all over the place. I had it continue anyway to see what would happen. Output: `Status: success No inline styles found in: Text/cover_page.xhtml Removed inline styles from: Text/part0000.xhtml Inline styles converted to new stylesheet: OEBPS/Styles/sgc_styles.css ` Saved, hit "no" to "fix on save". Result: Corrupt and unopenable book. Saved another copy and let it fix on save. Result: Corrupt and unopenable book. Repeated both of the above, but this time I manually edited all references to the original stylesheet to point to the new stylesheet. Result: Book would open and then Books.app freezes. Or with Calibre's epub reader, the text was still cut off on the left side. Repeated process but let it do the fix first. Similar results. Thank you for the help but I think at this point I should just stop burning time trying to get a perfect conversion and go with the good-enough albeit slightly unstyled version I made at the time of my first post. I'd like to know how to fix this properly, but I feel like we're getting into "do a discord call and screenshare to pair program in html" territory. |
![]() |
![]() |
![]() |
#13 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 36,873
Karma: 147879470
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
After saying no to the automatically fix, I would suggest under the Tools menu, click on Reformat HTML and then Mend and Prettify All HTML Files. Basically, it will attempt to fix the easily fixable errors. This should clean up the error you got from the plugin.
OTOH, it sounds as if this ebook is one of the idiocies where all content is stuffed into a single xhtml file. And a question that I likely should have asked earlier is the title/author of the book. It's possible that someone could grab a sample and see just how screwed up it is. |
![]() |
![]() |
![]() |
#14 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 74,669
Karma: 130140792
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
It sounds to me like this eBook would be best converted to ePub with calibre. Do not use KindleUnpack. Let calibre change the inline styles to CSS and to split any HTML files that are too long.
|
![]() |
![]() |
![]() |
#15 |
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,701
Karma: 87663461
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
  is just a non-breaking space. Those should be rare.
|
![]() |
![]() |
![]() |
Tags |
azw3 conversion, calibre, epub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Formatting Problem Converting .azw3 to .epub | save8lot | ePub | 7 | 08-12-2021 02:11 PM |
Please help! Formatting gets messed up when converting from EPUB to AZW3 | formatinghelpplz | Conversion | 5 | 10-09-2020 10:16 PM |
epub to azw3 conversion formatting issues | topquark | Conversion | 45 | 07-31-2014 05:28 AM |
EPUB to MOBI/AZW3 loses formatting | Siavahda | Conversion | 2 | 02-12-2014 03:35 PM |
Formatting issues when converting PDF to EPUB | raptir | Calibre | 2 | 10-21-2009 10:32 PM |