File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Should I implement this in Java or is there something better? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Should I implement this in Java or is there something better?" Watch "Should I implement this in Java or is there something better?" New topic

Should I implement this in Java or is there something better?

Rob Stark

Joined: May 16, 2012
Posts: 2
Hey all, I was recommended to come here by a CS buddy of mine. I want to develop an application that takes simple text inputs and produces a formatted output file, i.e. I already know what the format the output should take, and I want the user to only have to type in the content and not have to worry about the formatting. Ideally this output would be a document (PDF, RTF).

I've seen something like this deployed with Ruby on Rails on a website that works pretty well and produces an HTML page with the formatting applied, so I know it can be done. I'm just not sure what the easiest way is to develop this. My programming experience is relatively novice-to-intermediate with Java, but I do have fairly extensive web development experience in HTML, PHP, CSS (standard stuff), and I'm good at programming overall.

At the moment I bounced around the idea of making an application in Java to do this, but I'm not sure that's the best approach - to my knowledge, it wouldn't be terribly difficult making the UI for taking inputs, but going from those inputs to a formatted document could be nightmarish? I'm not really sure how good Java is at handling that :\

Anyway, any thoughts on this would be appreciated! Thank you!
Sudhir Ravindra

Joined: May 31, 2010
Posts: 16
If you only need formatting as in formatted display and like, go for perl, its the best and was built for such puposes.
However if you need DOC/PDF output then I am not certain how much support perl can give you, better stick to a technology you know of.
For e.g. POI library has support for generation of both formats and you can evaluate how best to achieve the formatting process itself. The formatting support in java is not the best, but should be good enough.
vinayak jog
Ranch Hand

Joined: Apr 01, 2011
Posts: 81

I have done a little work in developing pdf from text. We had used flying saucer library and itext libraries. you can get a lot of examples on how to convert html to pdf. Since you have told you have experience in web technologies you can use HTML for formatting and using itext or similar libraries you can spool it to pdf easily.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46383
Welcome to the Ranch

I think this question is too difficult for “beginning”, so I shall move it.
Jon Swanson
Ranch Hand

Joined: Oct 10, 2011
Posts: 214
I've used PDFjet to write pdf files from Java. It does not parse HTML, but is pretty easy to use.
Victor M. Pereira
Ranch Hand

Joined: Mar 02, 2012
Posts: 50
Well you could use jasperReports that can write to pdf and rtf and different presentation data.

Victor M. Pereira
Jan Cumps

Joined: Dec 20, 2006
Posts: 2565

No one promoted FOP yet?

FOP is my favorite.

OCUP UML fundamental and ITIL foundation
Rob Stark

Joined: May 16, 2012
Posts: 2
Thanks Campbell, appreciate the welcome!

And thank you everyone who has posted so far - I'm learning a lot already and can already see a lot of options opening up. I'll look into each ones in more detail and comment back, in the meanwhile any other suggestions are welcome!!

Thank you all again for the fast responses!
I agree. Here's the link:
subject: Should I implement this in Java or is there something better?
It's not a secret anymore!