<a class="savetopdf" href="#" onclick='
<%
try {
String w = result;// "<html><body> This is my Project </body></html>";
OutputStream file = new FileOutputStream(new File("E:\\newfile.pdf"));
Document document = new Document();
PdfWriter.getInstance(document, file);
document.open();
@SuppressWarnings("deprecation")
HTMLWorker htmlWorker = new HTMLWorker(document);
htmlWorker.parse(new StringReader(w));
document.close();
file.close();
} catch (Exception e) {
e.printStackTrace();
}
%>
>Save as PDF</a>
This is my code for save as Pdf currently it save to Given Directory But i want once i click on But save as PDf then It should download file which will pdf format.