The conversion consists of three steps:
1. Convert the HTML to XHTML
2. Convert the XHTML document to XSL-FO using an XSL stylesheet and an XSLT transformer
3. Pass the XSL-FO document to a formatter to generate the target PDF document
Let us start,download JTIDY,ask google for it.I think it is on sourceforge site.JTidy is a Java port of the Tidy HTML parser. In the process of translating to XHTML, JTidy also adds missing close tags to create a well-formed XML document.
read the article about that:
Convert HTML content to PDF format - Java World