title: Text File Data into PDF File using iText Java
body: <p>I have successfully created Text file. and i need to add those text in to PDF.
  its like i have everyday details in my text file. end of the month i need to generate pdf file with all the data.</p>
  
  <p>what i have done here is</p>
  
  <pre><code>          try
                {
                   PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("MonthlyReport.pdf"));
                   document.open();
                   document.add(new Paragraph("Month End Report."));
                   //Text file Data
                   try {
                          FileReader reader = new FileReader("MyFile.txt");
                          int character;
  
                          while ((character = reader.read()) != -1) {
                              document.add(new Paragraph((char) character));
                          }
                          reader.close();
  
                      } catch (IOException exception) {
                          exception.printStackTrace();
                      }
  
  
                   //Text File Data
  
  
                   document.close();
                   writer.close();
                } catch (DocumentException exception)
                {
                   exception.printStackTrace();
                } catch (FileNotFoundException exception)
                {
                   exception.printStackTrace();
                }
  </code></pre>
  
  <p>But the problem is it only creates the <code>Month End Report</code> part only. i have already checked <code>FileReader</code> working or not and it works fine. i dont understand why it is not working inside with <code>document.add</code></p>