This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Web Services and the fly likes Convert email to pdf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Convert email to pdf" Watch "Convert email to pdf" New topic
Author

Convert email to pdf

Mike Byrd
Greenhorn

Joined: Nov 01, 2010
Posts: 2
Good Afternoon-
I want to create a web service that converts an email to a pdf file. Has anyone done this before even with a java standalone application? The email would be in xml format. I've searched the JavaRanch forums but only Android link displays in the search results.

Thanks,
Mike
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
Two pdf creating toolkits that are widely used are iText and the Apache FOP project.

Bill
Mike Byrd
Greenhorn

Joined: Nov 01, 2010
Posts: 2
William Brogden wrote:Two pdf creating toolkits that are widely used are iText and the Apache FOP project.


Great! I wonder if both of them convert txt and html emails to pdf?

Thanks!
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
If the mail is in XML format, then it doesn't matter that it once was an email - now it's just content to be processed.

If you're comfortable with XSL-FO, then FOP is the way to go, as it takes XML input. If you prefer an API-driven approach, write a SAX parser and feed what it reads to the iText API.

Text emails have a relatively simple format, but HTML is going to be much harder. The FlyingSaucer library might help if it was CSS-styled XHTML.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert email to pdf