Я использую Itext PDF для генерации моего PDF, и он правильно сохраняется на сервере, но это должно быть загружено (сохранено) на стороне клиента. я вызвал метод для создания PDF из jsp страницы. вот мой код:
calling:
Document b = new JavaPdfHelloWorld().Generate_pdf(con.getCon(), file_no, pdt);
definition:
public class JavaPdfHelloWorld {
public Document Generate_pdf(Connection con, String file_no, PensionDataDao pdt) throws IOException, IOException {
Document document = new Document();
String home = System.getProperty("user.home");
System.out.println(home);
File file = new File(home + "/Downloads/dcrg-diff/" + name_of_pensioner + " " + space + " "
+ updated_file_no + ".pdf");
FileOutputStream pdfFileout = new FileOutputStream(file);
PdfWriter.getInstance(document, pdfFileout);
document.open();
document.add(new Paragraph("CALCULATION SHEET AS PER GRATUITY ACT 1972",
FontFactory.getFont(FontFactory.COURIER_BOLD, 18, Font.BOLD, BaseColor.RED)));
document.close();
writer.close();
return document;