title: ITEXT- Large PDF generation optimization
body: <p>I have to generate large PDF files , which has table with 30000 rows. I have to generate around 40 files which is taking 19 hours. Could any body suggest optimized way for the same. Most of the time taken by document.add(table) method.</p>
  
  <p>I am using ITEXT 5.4</p>
  
  <p>I used features of larElement interface , in my table I have 40 to 96 columns.</p>
  
  <p>I can post the code later. below is pseudo code.</p>
  
  <pre><code>public void createTable(rs,document){
      PdfpTable table = new PdfPTable(96)
      table.setComplete(false);
  
      int K=1;
  
      while(rs.next) {
  
          for(int i=1,i &lt;=columnCount;i++) {
  
              PdfPCell cell = new PdfPCell();
  
              Chunk chunk = new Chunk(rs.getString(i))
  
              cell.addElement(chunk);
  
              table.addCell(cell)
  
          }
          k++;
      }
  
      if(k%==10000) {
          document.add(table);
      }
  
      table.setComplete(true);
      document.add(table);
  }
  </code></pre>