Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Convert email to pdf

 
Mike Byrd
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two pdf creating toolkits that are widely used are iText and the Apache FOP project.

Bill
 
Mike Byrd
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic