Mobileread
Please help. Epub to kfx conversion extract css format from another book.
#1  Princess kindle 11-25-2022, 11:29 AM
Hi everyone, I study law and use a kindle, unfortunately the books of my degree are not in the amazon store, so I had to buy them in Epub. Now I want to convert them to kfx, but I want them to look the same in terms of format: margins, space between lines, indentation, space between titles and paragraphs and others like the books I bought on Amazon. Send to kindle only converts to azw3 but not to kfx.

1. Is there a way to extract the css styles of the kindle books that I like? To apply those parameters to my conversion

2. If not then could you please tell me your workflow to convert a book to kfx and have it as you like?

3. If there is a more direct way to address my problem please tell me. Maybe you are looking at the problem the wrong way.

4. I don't know anything about css but I want to learn because there is a lot of information here in the forums that would be very useful to me but I don't understand much of it. where to start? I searched about css in google but I see that it is for websites not for books, so I guess they are 2 different css.

Thank you all very much for your answers and have a nice day.
Reply 

#2  Comfy.n 11-25-2022, 12:53 PM
Quote Princess kindle
2. If not then could you please tell me your workflow to convert a book to kfx and have it as you like?
I don't recall whether this was much needed for KFX customisation, as there's been quite some time since I've used the KFX output plugin -- I don't even have Kindle Previewer in my current Windows installation. But I think you could play with the settings shown in this screencap:

show attachment »

CSS for ebooks is pretty much the same as for html, as EPUBs are mostly a bunch of xhtml files and images, though I think better answers regarding styling questions will come from other forum members.

Basically you have an element (paragraph, for instance) to which you apply a rule (text-align, for example)
Reply 

#3  Comfy.n 11-25-2022, 12:56 PM
Forgot to suggest opening any EPUB you like in Calibre Editor or Sigil, and see what CSS rules you'd like to tweak
Reply 

#4  Quoth 11-25-2022, 01:19 PM
The azw3 is closer to epub than KFX.
We don't create KFX at all.
Even on Amazon, if you used Download for USB transfer and a Kindle that has later than FW 3.5.x or so you never get KFX. KFX is delivered to Kindle apps and newer Kindles using WiFi/3G/4G etc.
Reply 

#5  JSWolf 11-25-2022, 02:41 PM
You can download Kindle Previewer and install the KFX plugins for Calibre and use Calibre to convert your ePub to KFX and then send the KFX to your Kindle via USB.
Reply 

#6  Tex2002ans 11-25-2022, 05:46 PM
Quote JSWolf
You can download Kindle Previewer and install the KFX plugins for Calibre and use Calibre to convert your ePub to KFX and then send the KFX to your Kindle via USB.
Yep. I agree.

Quote Princess kindle
[...] I had to buy them in Epub. Now I want to convert them to kfx, but I want them to look the same in terms of format: margins, space between lines, indentation, space between titles and paragraphs and others like the books I bought on Amazon.
Ahhh... getting all your ebooks to "look exactly the same"... that's a bit more trouble. The holy grail.

Every single book is going to be completely different on the inside, so there's no one-button press or one-button solution for this.

- - -

Your best bet, like JSWolf said, is to just:

1) Convert your EPUBs into Amazon formats using Calibre or Kindle Previewer.

2) Transfer that over to your Kindle.

- - -

To try to "normalize all your ebooks"... that's a lifelong task. :P

If you learn the basics of HTML+CSS though, you COULD know enough to go inside ebooks and fix some particularly egregious errors.

Like let's say you try to read a book and the font size is HORRIBLE.

You could poke around inside and remove the offending code.

Or if the publisher accidentally stuck dark text/backgrounds, making "Dark Mode" impossible (black-on-black text). You could go in and fix those pieces.

Quote Princess kindle
3. If there is a more direct way to address my problem please tell me. Maybe you are looking at the problem the wrong way.
Do the conversion way... save your time/sanity. :P

- - -

But, if you really want to learn about ebooks... then you could dig into the innards.

Open some of those EPUBs in Sigil/Calibre and take a look inside.

Or if you have Amazon ebooks, install the fantastic Calibre plugins:

That lets you convert from Amazon's ebooks into an EPUB, which you can then open up and look inside.

Open up some of your favorite books and see how they do it.

- - -

Another great way to learn is to find ebooks in the MobileRead library.

You can open those up and look inside + see how they're created. Usually the people here take very high pride in their work, so the HTML+CSS is going to be A LOT CLEANER and easier to understand.

If you want to see some of my ebooks, here's an example:

I did that one in 2019.

Open up that EPUB in Sigil and take a closer look.

For the most part, almost all my ebooks (over 650+) are using very similar code with only slight deviations.

Quote Princess kindle
1. Is there a way to extract the css styles of the kindle books that I like? To apply those parameters to my conversion
It's possible, it's possible.

But, like I explained above, each ebook is going to have unique innards, so things might not easily be able to carry over in "one button push".

Better to learn the basics of HTML+CSS, so you can open up the book and see WHAT THE HECK IT'S doing, then surgically go in there and correct your exact issue if needed.

Like if some heading is using an AWFUL FONT that's too thin + unreadable on e-ink, you can go inside and zap that problem. :P

Quote Princess kindle
4. I don't know anything about css but I want to learn because there is a lot of information here in the forums that would be very useful to me but I don't understand much of it. where to start?
I responded with some basic links/ideas in a post you just revived today:

Quote Princess kindle
I searched about css in google but I see that it is for websites not for books, so I guess they are 2 different css.
There is only 1 CSS, lol.

But the stuff geared towards websites is usually very fancy/complicated.

Ebooks are very simplified, and all you really need are:

The Basic Building Blocks of HTML + CSS

HTML basics

and CSS:

It seems overwhelming initially, but if you learn piece-by-piece, you can figure it out.

- - -

Like what does this do?

HTML:

Code
<h2>Why Homeschooled Children Love Reading</h2>
<p class="noindent">I saw the headline in Monday’s <i>Harvard Gazette</i>: “Life Stories Keep Harvard Bibliophile Fixed to the Page.” My first thought was, “I bet he was homeschooled.”</p>
CSS:

Code
h2 {	text-align: center;	text-indent: 0;
}
.noindent {	text-indent: 0;
}
Well, let's break it down:

And now let's look at the CSS:

There you go, now you're well on your way.

Open up your favorite ebooks and try to see what the heck they're doing. If you don't understand something, you can always ask.

- - -

Extra: What do you think this CSS does?

Code
blockquote {	margin-top: 1em;	margin-bottom: 1em;	margin-left: 10%;	margin-right: 10%;
}
.right {	text-indent: 0;	text-align: right;
}
Impossible!!!

- - -

Side Note: If you want to see that homeschooling ebook I worked on, you can find it here:

Open it in Sigil (or Calibre) and see the clean code! Poke around, see if you can figure out what piece does what!

Quote Princess kindle
Thank you all very much for your answers and have a nice day.
No problem.
Reply 

#7  Princess kindle 11-25-2022, 09:22 PM
Hello, I thank you all for your help. There are wonderful people here on this forum.

Dear Text2002 ans, you have given me a lot of information, it took me several days to learn everything you said. The examples you gave are wonderful, I appreciate that you have taken all the time to teach me, I will review what you say with a magnifying glass, perhaps that is why I suddenly take time to answer if I have any doubts.

Comfy.n don't know html either hahaha, the only thing I know about any programming language was a course of a few hours in python. I'm going to install sigil, I've heard a lot of good things here, and I'm going to play around with a book. spoiling you learn hahaha.


Jswolf : If I have the plugin, and have used it a couple of times, it's painfully slow. But I feel that I still need to know things, Amazon books look nice, but when they are converted, they lack I don't know what, they don't look professional. I am going to follow your advice to all of them and they are right when it comes to fixing the most serious or annoying errors, the rest is very cumbersome when you have several books. Greetings to all.
Reply 

#8  Notjohn 12-05-2022, 03:56 PM
I've used this style sheet for ten years: https://notjohnkdp.blogspot.com/2013/07/heres-my-style-sheet.html

I occasionally tweak it, but copying those items into a plain-text file named epub.css will handle about any book you're likely to create. (No tables. I don't mess with tables in ebooks.)
Reply 

Today's Posts | Search this Thread | Login | Register