Example #1
0
File: pdf.java Project: darsh56/jb
  public void pv() {
    try {

      Document document = new Document(PageSize.A4, 36, 72, 108, 180);
      PdfWriter.getInstance(document, new FileOutputStream("pdfFile.pdf"));

      File f = new File("abc.txt");
      FileReader fr = new FileReader(f);
      BufferedReader br = new BufferedReader(fr);
      String i;
      while ((i = br.readLine()) != null) {

        document.open();
        document.add(new Paragraph(i));
      }
      System.out.println("fetched database  is inserted into pdf file");

      document.close();
    } catch (Exception e) {
    }
  }