Shiny New E-Book Gizmo: The Amazon Kindle


View Full Version : lit2lrf.exe


waykohler
01-06-2007, 07:42 AM
Made a command line tool that converts Microsoft reader .lit files to the sony reader .lrf.

I reformat the html inside the .LIT to a layout I like .

Try it out .
It can convert whole directory structures or individual files.

lit2lrf is written in C++ and works as follows.
I use convertlit to extract the html from the lit.
I convert the html to .LRS using my own code.
I compile the LRS to .LRF using lrsparser. LrsParser is faster than lrs2lrf.

It's all done in unicode so non english books should work. But since I dont have anything to test with who knows.

I do not use the DLLs from the Toolbar for LIBRIe. They crash on large html files.

EDIT:
0.2: Hm, that first version was QUITE buggy.

0.3: msvcrt dependencies. I created a new version that is linked with a static libc.

0.4: Vista compability. Also made the tool less verbose.

0.5: Oops, Windows XP compability.

0.6: Support <BR> tag and other minor formating enhancements.

http://www.waykohler.com/lit2lrf/lit2lrf-0.6.zip

jbresee
01-07-2007, 08:44 PM
This is a great idea - tried it out, but it errors out 'cant find clit.exe'.

Any idea how to sort this out?
Thanks,
Jim

waykohler
01-07-2007, 08:57 PM
This is a great idea - tried it out, but it errors out 'cant find clit.exe'.

Any idea how to sort this out?
Thanks,
Jim

Im not sure... Try typing the full path to the lit2lrf.

For example: c:\path\lit2lrf ebook.lit

All the 3 executables in the zip needs to be in the same folder.

/Johan

jbresee
01-09-2007, 08:20 AM
I tried calling out the full path as suggested:

c:\lit2lrf\lit2lrf niven-wrong-way-street.lrf
'/clit.exe' is not recognized as an internal or external command, operable program or batch file.

I'm running Vista... perhaps that's boogering things up a bit?

Thanks,
Jim

Alexander Turcic
01-09-2007, 10:39 AM
It works very well for me. Thank you Johan!

waykohler
01-09-2007, 01:00 PM
I tried calling out the full path as suggested:

c:\lit2lrf\lit2lrf niven-wrong-way-street.lrf
'/clit.exe' is not recognized as an internal or external command, operable program or batch file.

I'm running Vista... perhaps that's boogering things up a bit?

Thanks,
Jim

c:\lit2lrf\lit2lrf niven-wrong-way-street.lrf
That should be .lit not .lrf

I'll try it under vista tonight.

/Johan

waykohler
01-09-2007, 11:57 PM
c:\lit2lrf\lit2lrf niven-wrong-way-street.lrf
That should be .lit not .lrf

I'll try it under vista tonight.

/Johan

Jupp, it was vista.
Posted a new version.

/Johan

waykohler
01-11-2007, 12:44 PM
Now that there is a fair amount of people that downloaded this tool.

How's the generated lrf's?
Have you found LIT's that generates bogus LRF's?
Does it work at all?

jbresee
01-13-2007, 05:58 PM
Thanks so much Johan!!!

Now I can continue to purchase sci-fi books from fictionwise and use them on my reader!

Thanks sooo much,
Jim

waykohler
01-14-2007, 04:12 AM
Thanks so much Johan!!!

Now I can continue to purchase sci-fi books from fictionwise and use them on my reader!

Thanks sooo much,
Jim

A bit of a warning Jim. My tool only handles non DRM .LIT files.
If fictionwise protects their files it will not convert.

There is ways to unprotect your files.
This program can be used to do that: http://www.convertlit.com/index.php
The legality of doing the unprotection is described under legal on the site.

/Johan

jbresee
01-15-2007, 07:49 AM
A bit of a warning Jim. My tool only handles non DRM .LIT files.
If fictionwise protects their files it will not convert.

There is ways to unprotect your files.
This program can be used to do that: http://www.convertlit.com/index.php
The legality of doing the unprotection is described under legal on the site.

/Johan


Thanks for the heads up... DRM makes me crazy. I'm not sharing my unprotected ebooks - just mvoing them to my reader.
The industry seems determined to kill this market before it even gets started!
Thanks again for your work on lit2lrf.
Jim

Doof
01-15-2007, 01:27 PM
This is an awesome piece of work!

Any chance it will support images and TOC in the future?

waykohler
01-15-2007, 05:17 PM
This is an awesome piece of work!

Any chance it will support images and TOC in the future?
Thank you Doof.

TOC:
Yes this is planed.

Images:
The title page will be supported.
Im not so sure about images in the book itself. Hard to do and not in the scope of this tool, use a html converter instead.

Vaporware
01-22-2007, 10:46 PM
I have used your tool in a long process of converting an HTML page to LRF. I went from HTML->RTF where I stripped some of the formatting->LIT->Lit2LRF->LRF.

Is there a way to handle this document's formatting better? I have looked in each step and lit2LRF makes the largest changes. Obviously the links in the TOC can be stripped out but the appear to have been combined into one large paragraph.

I have included all files generated. Don't worry, they're gutenburg.

waykohler
01-23-2007, 12:53 AM
I have used your tool in a long process of converting an HTML page to LRF. I went from HTML->RTF where I stripped some of the formatting->LIT->Lit2LRF->LRF.

Is there a way to handle this document's formatting better? I have looked in each step and lit2LRF makes the largest changes. Obviously the links in the TOC can be stripped out but the appear to have been combined into one large paragraph.

I have included all files generated. Don't worry, they're gutenburg.
There is lots to be done in lit2lrf. The formating is far from perfect, the only thing it does is change the font size and bold/italic. There is no center or anything like that.

One thing you can do to organize it better is to insert page breaks. It does honor those.

But, there is lots to improve in lit2lrf I just need to find some time.

I did some small changes to support the <BR> tag. And uploaded a new version.

/Johan

Vaporware
01-23-2007, 09:17 AM
Thanks, I'll do some more formatting and see what I can come up with

dstampe
01-24-2007, 05:41 AM
To be really useful (that is, something I'd use rather than converting the book to RTF then to PDF) it would need these features (as settable options):

- Parse and use style files (in some cases this could be replaced by forcing a font size and name).

- Change the specified font and scale the size (for readability)

- Embed non-standard fonts in the LRF.

- Possibly enforce format changes (i.e. all boldface) for readability, convert full-justify to left-justify as this may be more readable).

- handle LRF files with multiple HTML files embedded (some books have the text divided into many small files).

- TOC would be nice, especailly for long books.

jonbaber
01-24-2007, 05:52 PM
Nice work Waykohler... this is a great tool! Much easier than converting it all manually, and nicely formatted too.

So far the only .lit that hasn't worked is a copy I have of Ken Follett's - Pillars of the Earth, but that is a problem with clit itself. I have never been able to convert that file for some reason. Luckily I have a paperback copy of it :)

waykohler
01-26-2007, 01:14 AM
To be really useful (that is, something I'd use rather than converting the book to RTF then to PDF) it would need these features (as settable options):

- Parse and use style files (in some cases this could be replaced by forcing a font size and name).

- Change the specified font and scale the size (for readability)

- Embed non-standard fonts in the LRF.

- Possibly enforce format changes (i.e. all boldface) for readability, convert full-justify to left-justify as this may be more readable).

- handle LRF files with multiple HTML files embedded (some books have the text divided into many small files).

- TOC would be nice, especailly for long books.
Thanks for your feedback dstampe.

Hm, style file. Can you describe this in more detail? Im afraid I dont know what that is. There is a style section in the html but I dont think I have seen a lit with a style file.

The font size can be changed by pressing the size button on the reader. Not exactly what you want but....

Non standard fonts... Hm.. I always meant to not use the fonts in the LIT itself but reformat it totally according to my rules. LIT files has a tendency to be formated very differently and I like my books standardized. If you don't like my style... :) Well I'll see if I can do a "style" editor later on.

It actually does handle multiple html files in one LIT file. Is does a page break in between them.

Yupp TOC would be nice.

NetVicious
02-03-2007, 09:58 AM
Hi! Thanks a lot for your application.

I got this error when trying to transfor a lit file.

Extracting.
Converting.

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

If you want please send me a private message and I could send you the .lit file

Thanks.

Doof
03-14-2007, 09:53 AM
Any news on this?

dstampe
03-15-2007, 07:39 AM
Thanks for your feedback dstampe.

Hm, style file. Can you describe this in more detail? Im afraid I dont know what that is. There is a style section in the html but I dont think I have seen a lit with a style file.

The font size can be changed by pressing the size button on the reader. Not exactly what you want but....

Non standard fonts... Hm.. I always meant to not use the fonts in the LIT itself but reformat it totally according to my rules. LIT files has a tendency to be formated very differently and I like my books standardized. If you don't like my style... :) Well I'll see if I can do a "style" editor later on.

It actually does handle multiple html files in one LIT file. Is does a page break in between them.

Yupp TOC would be nice.


In explanation for some of these requests, I am looking at how to use the contents of a Microsoft Reader file. This consists of (at least for this book) a set of HTML files (about 40, with one chapter, title page, cover etc. in each) and links to form the book.

All style (paragraph and fonts) is in .CSS files (these are the page style files) for the text, with embedded tags in the text to select a style and to to set bold, italic etc. So these files need to be changed in order to set font face and style.

Finally, the nonstandard fonts are to make the text more readable on the smaller, lower contrast Sony Reader display. This really needs a larger font with fatter strokes such as a boldface Arial or Tiresias Bold. Times Roman types just are not very legible to me on the reader.

In the end, on this project I had to just convert the LIT to HTML, then the HTML to RTF (thus losing all pictures and structure), then hand-splicing the RTF files back into books, then convert all but boldface to boldface Arial and the ofiginal boldface to boldface Courier New (as boldface was critical for this book). Not great, but at least the Reader could handle the resulting RTF file well. I also tried converting to a PDF file with embedded fonts, but anything over 300 pages was ridiculously slow in turning pages in the last half, and there seemed to be a hard limit of 1000 PDF pages (I have not been able to get feedback as to whether anyone else has encountered this limit).

This is not something I'd want to repeat on a lot of books. So some kind of way to embed the desired fonts in the LRF and to change font type and size tags in the CSS and HTML files would be enough.

As for the TOC, I'd be OK if there was a page with links that could be bookmarked, then navigated via the existing HTML links.

dhbailey
03-16-2007, 04:52 AM
I am running into problems with lit2lrf -- I downloaded the 3 free ebooks from silkpagoda in .lit format (just to test things out).

I was able to get lit2lrf to run apparently, but encountered the following:
dragga.lit (103KB) became dragga.lrf (3KB) and in the desktop Connect software the .lrf book shows that there are 2 pages but they are blank.

jourwest.lit (1.3MB) became jourwest.lrf (1.6MB) but when I open in the Connect software Journey West opens showing 1 page, which is blank.

What did I do wrong? I extracted all 3 of the zipped programs into c:\lit2lrf and I get no error messages when attempting the conversion.

humandroid
03-20-2007, 10:17 PM
Any idea what would cause this?

lit2lrf r.lit
r.lit
Extracting.
Converting.
Compiling LRF.
No file created.'C' not found.

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

EatingPie
03-31-2007, 09:22 PM
Is this locked in to Windows?

You mentioned it's a command line tool, and I've had some luck so far compiling other things. I've actually been added paragraph flow and smart quote support in makelrf3 under Mac OS X Intel (endian's an issue, so the Intel saves me here).

-Pie

phigdon
04-01-2007, 05:13 PM
i cant get it do more than start in a dos window and it closes in less than a second. i also tried typing out the command line any ideas?

Elltrain
05-14-2007, 01:30 AM
Use the -v option. This fixed the "not doing anything" behavior for me, but the file I converted had the first word of every paragraph missing.

kovidgoyal
05-14-2007, 02:38 PM
A more powerful (cross platform) alternative
clit + html2lrf

NetVicious
05-19-2007, 01:16 AM
Hi kovidgoyal.

Could you tell us the website for clit. I Googled but clit it's a very used word :D

kovidgoyal
05-19-2007, 01:23 AM
http://www.convertlit.com/

HarryT
05-19-2007, 01:40 AM
Hi kovidgoyal.

Could you tell us the website for clit. I Googled but clit it's a very used word :D

There's obviously a lot of people out there interested in converting LIT files, I guess!

:grin:

JSWolf
05-20-2007, 06:31 PM
Google for convert lit.