Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 01-20-2010, 06:17 PM   #1
Loccy
Junior Member
Loccy began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2009
Device: Cool-ER
EPUB (CSS) tweaker app

Hi all,

A week or so I posted about how frustrating it was that, when using Calibre to convert from LIT format, you have no control about the justification of your final EPUB - depending on the LIT it'll either be left justified or fully justified, but you get no ability to choose your preferred option. The sound of tumbleweeds drifting by was deafening (translation: no-one appeared to care based on the lack of responses I got to my post).

In the end I threw together the attached Java app and am posting here in case others also find it useful. Basically, it'll open up an EPUB and let you edit the CSS directly, then let you save the changes, saving you the aggro of extracting the EPUB and repacking it afterwards. In the simple editor the more "interesting" attributes (ie. the ones I find myself changing most often) are bolded, to assist the user when scanning down them:

text-align:
font-size:
and text-indent:

Those of you not CSS savvy, basically if you look for any references to text-align: left and change them to text-align: justify, that should do the trick. On some LIT conversions I've seen double paragraph indentation happen - usually this is because there's a base style called section AND individual styles for the paragraphs, both with an indent. If you remove the text-indent line from the section style, that'll resolve the double indent.

This has not been tested to any great degree so you are advised to back up any EPUBs first! It's also only been tested on a Mac (but it's Java, so should run OK on pretty much anything).

To use, download the file, BUT DO *NOT* EXTRACT THE ZIP. Instead, rename it from epub-tweaker.zip to epub-tweaker.jar. If you have Java you should then be able to run it by double-clicking, and load an EPUB from the File menu.
Attached Files
File Type: zip epub-tweaker.zip (13.4 KB, 1481 views)
Loccy is offline   Reply With Quote
Old 01-21-2010, 03:37 AM   #2
ChristopherTD
Addict
ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.
 
ChristopherTD's Avatar
 
Posts: 317
Karma: 1008290
Join Date: Apr 2008
Location: London. UK
Device: Marvin Reader on iPad Air (via Calibre)
Wonderful! I was wondering about something to do just that (see http://www.mobileread.com/forums/showthread.php?t=69837).

Your script works on my Mac! I will tinker with it in depth shortly, but it looks like just what I want to amend CSS from ePub titles that I have purchased, but which don't render nicely on the PRS-600 or iPhone. Brilliant stuff.

Many thanks.

Last edited by ChristopherTD; 01-21-2010 at 03:46 AM.
ChristopherTD is offline   Reply With Quote
Old 01-21-2010, 05:58 AM   #3
Solicitous
Wizard
Solicitous ought to be getting tired of karma fortunes by now.Solicitous ought to be getting tired of karma fortunes by now.Solicitous ought to be getting tired of karma fortunes by now.Solicitous ought to be getting tired of karma fortunes by now.Solicitous ought to be getting tired of karma fortunes by now.Solicitous ought to be getting tired of karma fortunes by now.Solicitous ought to be getting tired of karma fortunes by now.Solicitous ought to be getting tired of karma fortunes by now.Solicitous ought to be getting tired of karma fortunes by now.Solicitous ought to be getting tired of karma fortunes by now.Solicitous ought to be getting tired of karma fortunes by now.
 
Posts: 1,413
Karma: 1137946
Join Date: Aug 2009
Location: TAS, Australia
Device: Astak Pocket Pro (Black), 2 x Kindle WiFi (Graphite), iPod Touch 4G
Absolutely brilliant. I posted a while ago about converting from .LIT to .EPUB with text justification problems. This java app solves the problem. Just for your reference I ran it on Ubuntu 9.10 without any issues.

Thanks for posting the app.
Solicitous is offline   Reply With Quote
Old 01-21-2010, 07:23 AM   #4
ChristopherTD
Addict
ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.
 
ChristopherTD's Avatar
 
Posts: 317
Karma: 1008290
Join Date: Apr 2008
Location: London. UK
Device: Marvin Reader on iPad Air (via Calibre)
Outstanding! Using this I was quickly able to refine a troublesome book so that it easy to read on my PRS-600.

Many, many thanks for such a wonderful little utility!
ChristopherTD is offline   Reply With Quote
Old 01-21-2010, 09:30 AM   #5
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,886
Karma: 12755553
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by Loccy View Post
Hi all,

A week or so I posted about how frustrating it was that, when using Calibre to convert from LIT format, you have no control about the justification of your final EPUB - depending on the LIT it'll either be left justified or fully justified, but you get no ability to choose your preferred option. The sound of tumbleweeds drifting by was deafening (translation: no-one appeared to care based on the lack of responses I got to my post).
I don't recall seeing your post. I thought that what you are doing is what the extra CSS area under look and feel area was for. This area states that you should place here:
Quote:
"Either the path to a CSS stylesheet or raw CSS. This CSS will be appended to the style rules from the source file, so it can be used to override those rules."
I haven't used it but there are threads talking about using this field to adjust exactly what your doing.

Anyway Kudos for creating a tool to help the community here.
DoctorOhh is offline   Reply With Quote
Old 01-21-2010, 11:16 AM   #6
Loccy
Junior Member
Loccy began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2009
Device: Cool-ER
Quote:
Originally Posted by dwanthny View Post
I don't recall seeing your post. I thought that what you are doing is what the extra CSS area under look and feel area was for. This area states that you should place here:
I haven't used it but there are threads talking about using this field to adjust exactly what your doing.

"Either the path to a CSS stylesheet or raw CSS. This CSS will be appended to the style rules from the source file, so it can be used to override those rules."
Anyway Kudos for creating a tool to help the community here.

But I don't want (and it seems, neither do other people in this thread ) extra CSS. I wanted to be able to quickly and easily modify one single parameter of one single CSS style on my EPUB. Basically I want to control, exactly, what the CSS says - not to add additional, potentially contradicting rules. For example, on the extra CSS area, how would you go about modifying a particular style's text-justify parameter from left to justify? It's also a lot lighter weight than Calibre proper if all you want to do is quickly change from left to right justify, or tweak indention or font sizes.
Loccy is offline   Reply With Quote
Old 01-21-2010, 03:53 PM   #7
ChristopherTD
Addict
ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.ChristopherTD ought to be getting tired of karma fortunes by now.
 
ChristopherTD's Avatar
 
Posts: 317
Karma: 1008290
Join Date: Apr 2008
Location: London. UK
Device: Marvin Reader on iPad Air (via Calibre)
Also, if you are tweaking the CSS for a book purchased in ePub format, this avoids the need to do an ePub-2-ePub conversion in Calibre (a usually harmless step, but one that cannot easily be undone).
ChristopherTD is offline   Reply With Quote
Old 01-21-2010, 04:12 PM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 37,824
Karma: 18755150
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
Quote:
Originally Posted by ChristopherTD View Post
Also, if you are tweaking the CSS for a book purchased in ePub format, this avoids the need to do an ePub-2-ePub conversion in Calibre (a usually harmless step, but one that cannot easily be undone).
Providing the eBook has no DRM or you are able to strip the DRM.
JSWolf is offline   Reply With Quote
Old 01-23-2011, 11:07 PM   #9
heddhunter
Junior Member
heddhunter began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jan 2011
Device: Kindle 3
Quote:
Originally Posted by Loccy View Post
But I don't want (and it seems, neither do other people in this thread ) extra CSS. I wanted to be able to quickly and easily modify one single parameter of one single CSS style on my EPUB. Basically I want to control, exactly, what the CSS says - not to add additional, potentially contradicting rules. For example, on the extra CSS area, how would you go about modifying a particular style's text-justify parameter from left to justify? It's also a lot lighter weight than Calibre proper if all you want to do is quickly change from left to right justify, or tweak indention or font sizes.
The "C" in "CSS" stands for "Cascading"... it's MEANT to be overridden!

That said, your utility is awesome... I gave it a shot and it looks like it will be really handy. Nice one!
heddhunter is offline   Reply With Quote
Old 01-23-2011, 11:22 PM   #10
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,886
Karma: 12755553
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Welcome to Mobileread.

Quote:
Originally Posted by heddhunter View Post
That said, your utility is awesome... I gave it a shot and it looks like it will be really handy. Nice one!
When possible please do not reopen year old obsolete threads. There is a reason you were presented with and Old Thread Warning when you went to post to this thread.

This feature is essentially built into calibre via the right click menu. Select the book you wish to tweak in calibre's library view. Right click the book and choose Tweak Epub, explode the epub and open the css in your favorite editor, I use notepad++. Edit and save the css, rebuild epub.
DoctorOhh is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hacked AdobeViewer.app with userstyle1.css tselling PocketBook 62 10-29-2012 11:40 PM
converting to epub with my css fbrzvnrnd Calibre 3 04-15-2010 03:46 AM
ePub to ePub - just replace CSS? ChristopherTD Calibre 21 02-11-2010 03:50 AM
Modifier le .css d'un .epub freak Software 9 11-26-2009 04:58 AM
Firefox Tweaker: Flexbeta FireTweaker XP Alexander Turcic Lounge 0 08-16-2004 05:51 AM


All times are GMT -4. The time now is 11:27 PM.


MobileRead.com is a privately owned, operated and funded community.