This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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: 12761
    
    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.
 
Consider Paul's rocket mass heater.
 
subject: Convert email to pdf
 
Similar Threads
How to create a .pdf file?
EMail attachment File Name: HOW TO?
pdf converter
How to parse PDF File
SCJP 1.6 mock exams please???