I have the following code to convert the html to pdf and two intermediate files getting created.
File file = new File("file.tmp");
String y1 = "<html><body><table><tr><td><textarea>Hello <br> world1";
String y1+= "</textarea></td></tr> </table></body></html>";
FileWriter fw = new FileWriter(file);
fw.write(y1);
fw.close();
FileReader r = new FileReader(file);
Tidy tidy = new Tidy();
String tempFile = file + ".tmpPdf";
FileWriter w = new FileWriter(tempFile);
tidy.parse(r, w);
r.close();
w.close();
SAXBuilder builder = new SAXBuilder("org.ccil.cowan.tagsoup.Parser", false);
DOMOutputter doo = new DOMOutputter();
ITextRenderer render1 = new ITextRenderer();
render1.setDocument(doo.output(builder.build(new FileReader(tempFile))), null);
render1.layout();
File file1 = new File("file1.pdf");
FileOutputStream fw1 = new FileOutputStream(file1);
render1.createPDF(fw1);
fw1.close();
The output is Hello World1 in a single line. I want it to be in new lines as I used br tag. How to achieve this goal?