Append and modify CSS when sending epubs to Kobo devices
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
calibre |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
This allows users to have a "kobo_extra.css" file in the root of their device containing CSS rules. This will be appended to all stylesheets in the epub. As well, if the extra rules contain an @page rule, any existing @page rules will be stripped from the stylesheets. Finally, if any of the extra rules include "widows" and "orphans" settings, these are stripped from the rules in the stylesheets.
There is an option added to the driver configuration to enable this action.
If an epub has DRM it cannot be modified but it will still be sent.
The changes have been coordinated with the author of the KoboTouchExtended driver. He has made changes so that these changes will not break his driver. And he will have a version ready to take advantage of the change.
When looking for css files in the book, dont look for files that end
with .css, use mimetypes instead, namely, container.mime_map.
Also, note that unless an epub has previosuly been processesd by
calibre, there is no guarantee that its style info is in css files at
all. It could be in <style> tags or style attributes inside the html. So
if you want to apply extra css robustly, you would have to add a new
stylesheet and <link> to it from every html file. You would probably
also need to add !important to all style rules to try to ensure they
override the existing rules. However, using !important will probably
have other side effects, depending on how the reader in Kobo devices
works. Generally speaking, modifying css is a highly non-trivial
excercise, which is why the calibre conversion pipeline is as complex as
it is. You could just say that the extra css is a "best effort" thing,
where the driver does not guarantee that addingthe extra css will have
any effect at all, that is up to you.
Finally, if you re-order the options in the driver, saved settings will
break, since, IIRC, the saved settings are stored as a list with
individual settings at fixed indices, though I may be misremembering.
status incomplete