aspose file tools*
The moose likes Java in General and the fly likes How to create the PDF in java from the String(containing HTML tags basically HTML string ) in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to create the PDF in java from the String(containing HTML tags basically HTML string ) in java" Watch "How to create the PDF in java from the String(containing HTML tags basically HTML string ) in java" New topic
Author

How to create the PDF in java from the String(containing HTML tags basically HTML string ) in java

Karn Kumar
Ranch Hand

Joined: Aug 06, 2009
Posts: 146

I have the HTML of some page in the String format
for example :-
String sPDFContent="<table><tr><td>Chetan</td></tr><tr><td>test</td></tr></table>";
This String i want to convert in the PDF format .

This all i m doing because i want to send the PDF file which will generated dynamically, as an attachment in the e-mail.


If someone having more easy and better answer,suggest.

Thanks to everyone in advance.
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Read this page for a synopsis of all the libraries to choose from:

http://java-source.net/open-source/pdf-libraries
Sri Harsha Yenuganti
Greenhorn

Joined: Mar 02, 2010
Posts: 18
Use iTextPdf libraries !

http://itextpdf.com/

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

+1 on iText for simple HTML documents. For more advanced documents I've used Yahp with some success. It's not perfect but better than a lot of commercial products I've tried.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Karn Kumar
Ranch Hand

Joined: Aug 06, 2009
Posts: 146

Hey Guys thanks a lot for your suggestion .

Finally i got solution after all...


I used PD4ML,PD4PageMark classes and pd4ml.render(urlstring, fos); method of PD4ML class .



Have a great day .....

Njoy....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to create the PDF in java from the String(containing HTML tags basically HTML string ) in java