Shiny New E-Book Gizmo: The Amazon Kindle


View Full Version : RTFToIliad tool


scotty1024
10-18-2006, 11:02 AM
This tool converts RTF files to iLiad sized PDF files.

Its one redeeming feature is that it can directly convert a Baen ZIP'd RTF file. :)

As time goes by I'll grow its brain (right now it represents 3 man hours, including writing the RTF parser from scratch) and it will handle more RTF commands to create fancier PDF output.

For now, it goes from Baen ZIP file to iLiad sized PDF in a single step.

It requires the PDF Box jar from http://www.pdfbox.org

Compile it: javac -classpath PDFBox-0.7.2.jar RTFToIliad.java RTFPullParser.java
Run it: java -classpath .:PDFBox-0.7.2.jar RTFToIliad DA1416509402.zip UntoTheBreach.pdf

scotty1024
10-19-2006, 10:10 AM
Today's version:
Supports Roman, Bold, Italic, Bold Italic
Page breaks
Paragraph spacing adjustment
Flows text better
Various bug fixes.

Most all of the active Baen formatting commands are working and the output PDF looks much closer to Word's view of it.

CommanderROR
10-20-2006, 11:49 AM
Thanks for taking the time to do this Scotty!

I don't use .rtf books myself at the moment, but I'm sure all the users that actually use .rtf books like theose from Baen will love this.

Keep up the good work!

scotty1024
10-20-2006, 02:56 PM
I don't use .rtf books myself at the moment, but I'm sure all the users that actually use .rtf books like theose from Baen will love this.

Keep up the good work!

Thanks!

I didn't have much use for RTF either but I've found that the Baen RTF downloads are closer to the LIT downloads in terms of readability than the HTML downloads.

I use a LIT parser to make my BBeB books but felt an "open" RTF parser was the way to go for the iLiad. Besides, how hard could it be to whip up an RTF parser. :)

Today is the third posting and with it all the line breaking and page breaking have been implemented. I also cleaned up an RTF bug with \' processing only to discover my good buddy PDFBox only writes out Standard Encoding PDF's. So most of the \' chars are not available in Standard Encoding, oh well... I'll keep picking at it. But I'm not dying for copyright and tilde n characaters so far...

The right hand margin gets a bit bent since I turned on the indent for first line support. Working on that one too.

Other than that, the Baen titles appear readable to me. Being able to download them and feed them straight through the tool certainly saves me time and fiddling when I buy a new title to read.

BTW Java source can be compiled to .exe's with the GCC compiler for those that don't like Java.

rpink
10-24-2006, 12:02 PM
Hi scotty1024,

yust tryed to compile and got 2 errors where a explicit typecast was missing.
For the ones who donīt know java enough.

Problem:
RTFPullParser.java:247: isDigit(char) in java.lang.Character cannot be applied to (int)
} else if (Character.isDigit(c) ||
^
RTFPullParser.java:268: isDigit(char) in java.lang.Character cannot be applied to (int)
} else if (Character.isDigit(c)) {

fixed it with
RTFPullParser.java:247: isDigit(char) in java.lang.Character cannot be applied to (int)
} else if (Character.isDigit((char)c) ||
^
RTFPullParser.java:268: isDigit(char) in java.lang.Character cannot be applied to (int)
} else if (Character.isDigit((char)c)) {

So now i have probaly a missing font, later more. :uhoh2:

scotty1024
10-24-2006, 09:03 PM
What did you try to compile it with?

The standard Sun javac had/has no problems compiling the code to produce the .class files included in the zip file...

rpink
10-25-2006, 03:40 AM
OpenSuse 10

java-1.4.2-sun

scotty1024
10-25-2006, 02:38 PM
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Character.html

CommanderROR
10-25-2006, 03:39 PM
@scotty1024

Why don't you start posting your apps and hacks in the Sticky http://www.mobileread.com/forums/showthread.php?t=8167 ?

You are doing so many things that it is becoming hard to follow all your efforts. The thread was created specifically for the purpose of making the findings of all mobileread.com "developers" eaiser and fast to find.

Thanks.

NatCh
10-25-2006, 03:58 PM
I can't follow them even when I find them all. :laugh4:

scotty1024
10-25-2006, 08:54 PM
OpenSuse 10

java-1.4.2-sun

You'll find that 1.5.0_09 is noticeably faster in addition to compiling RTFToIliad with no complaints.

You can download it directly from Sun: http://java.sun.com/javase/downloads/index.jsp