View Full Version : Pissed off with LRF formatting: LRF/LRS clean tool?

12-11-2009, 09:33 AM
Probably many of you have experienced this: you get an ebook, maybe in lit or rtf (or ever lrf itself), convert it to lrf using ebook-convert, and it looks like shit on your ebook reader (not calibre's fault, the original file is already crappy), namely:
- font too big/small
- line spacing keeps changing (sometimes the last line of every paragraph has some extra space on top)
- some parts of the text have weird sizes
- excessive margin top/down
- no spacing between paragraphs or first line indentation.

How do you cope with it?

For the font size thing, I've tried converting with calibre, but it seems to ignore my font size preferences (tried the last version yesterday, still no luck). For now I'm using a little perl script that reduces all font sizes by a factor. But the other problems remain.

I have then converted lrf to lrs and examined the source. Guess what's in there, a gazillion styles and lots of <Span> with custom formatting things within the <P>.

If there is no solution already there I'm thinking about picking an ebook that currently displays correctly, taking the BlockStyle and TextStyle that are used in the majority of the paragraphs, and writing a script that will substitute the most used BlockStyle and TextStyle for those, thus giving all my books a consistant look.

Of course, the whole lot of <Span>s in the text will do their weird things, maybe it's a good idea to remove them...

But of course if there is a tool available I might as well use it; do you guys know of any?

GNU/Linux only, I don't have (or will have) Windows.


12-11-2009, 11:33 AM
How do you cope with it?
I convert everything to HTML, clean it up until it matches my standards, then convert it to LRF or EPUB or whatever using Calibre. In some cases, I convert it to plain text, then add HTML tags around paragraphs and chapters etc.

12-12-2009, 09:12 AM
For all the reasons you describe, it is important to first convert to an editable format. Get that looking nice, and THEN convert to your desired "target" format.

Unfortunately my solution (which is to use the Windows tool, "Book Designer") will not work for you.

12-17-2009, 12:53 AM
I thought I was doing just that... Converted the files to rtf, edited them exactly as I want them to be (right page size, right font size, right justification...)

When I convert it back to LRF though it inserts blank lines (even though I check "remove blank lines after paragraph" AND there are none to begin with in the RTF, whatever is centered before becomes justified, the page breaks aren't respected, etc, etc.

Would using HTML help? And if so... How do you edit an HTML file? I've only ever been able to view them.

(I should note that my rtf files aren't read normally either. For some reason they only have half the pages that they do on the computer, and the font turns tiny.)

01-23-2010, 11:22 AM
I have exactly the same issues. As you say, calibre adds the blank lines when converting to lrf even if it works fine when converting to epub. I can't imagine why, maybe it's the <span> madness.

I am also a linux user. FYI, bookdesigner does work under wine (I use a commercial version, Codeweavers). Mind you install internet explorer 6.0 first. It's by far the best tool there is for getting lrf right. But, you have to learn how to use it and it's not very intuitive, although you can find an excellent tutorial on this forum.

You edit html by hand simply opening the file with a text editor. Kate, gedit or gvim, for example.

02-11-2010, 12:38 PM
Yes the spaces between paragraphs in LRF files created by Calibre is annoying me as well. I converted the current series of books I am reading to ePub just to lose the spaces but I hate the fact the text is not fully justified like in a real book.

I would have a go at editing the Calibre code for LRF creation but I wouldn't even know what file to look at.

I had a look at Book Designer 4 but it didn't appear to support LRF.

02-12-2010, 04:15 AM
BD certainly supports LRF - it's what I use to create all the LRF books that I've uploaded to MR's library.

02-15-2010, 01:39 PM
I suppose 'carbonize' means book designer can't open a lrf file. That's true. I convert my books to html or rtf, edit them to my heart content with BD and then I make lrf files. If they are pdf, I open them directly with BD and use some regex to get rid of the headers and footers. I am not a regex ninja so if it gets too complicated, I crop the pages with Adobe Acrobat (the commercial version), delete the hidden text (Document - Examine Document) and then I open the file with BD. I know it sounds complicated, but once you've done it a couple of times, it becomes automatic.

02-15-2010, 02:14 PM
Yes, that is true. BD can create LRF files, but not edit them. Apologies for the misunderstanding.