title: Add page title between PdfPTables in iText
body: <p>I have a number of <code>PdfPTable</code>s that is following each other like this:</p>
  
  <p><img src="https://i.stack.imgur.com/PORVl.png" alt="enter image description here"></p>
  
  <p>Is it possible to add a title on all of the page(not just the first page)? I believe I cant use the <code>PdfPageEventHelper</code> because the table that is first on each page needs to be moved down(to not overlap the title).</p>
  
  <p>Any ideas or tips how this can be solved? I cant figure out how to know if there has been a new page or not for each of the tables.</p>
  
  <pre><code>public class TableDemo {
  
      /** The resulting PDF file. */
      public static final String RESULT = "first_table.pdf";
  
      /**
       * Main method.
       * @param    args    no arguments needed
       * @throws DocumentException 
       * @throws IOException
       */
      public static void main(String[] args)
          throws IOException, DocumentException {
          new TableDemo().createPdf(RESULT);
      }
  
      /**
       * Creates a PDF with tables
       * @param    filename the name of the PDF file that will be created.
       * @throws    DocumentException 
       * @throws    IOException
       */
      public void createPdf(String filename)
          throws IOException, DocumentException {
          Document document = new Document();
          PdfWriter.getInstance(document, new FileOutputStream(filename));
          document.open();
  
          document.add(addTitle());
  
          for(int i=0; i&lt;10; i++)
              document.add(createTable());
  
          document.close();
      }
  
      /**
       * Creates our table
       * @return our table
       */
      public static PdfPTable createTable() {
          PdfPTable table = new PdfPTable(4);
  
          int rows = (int)(Math.random()*30+1);
          for(int row=0; row&lt;rows; row++){
              for(int cell=0; cell&lt;4; cell++){
                  table.addCell("row "+row+"; cell "+cell);
              }
          }
  
          table.setKeepTogether(true);
          table.setSpacingAfter(30);
  
          return table;
      }
  
      public static Paragraph addTitle(){
           Font fontbold = FontFactory.getFont("Times-Roman", 40, Font.BOLD);
           Paragraph p = new Paragraph("TITLE ON EACH PAGE", fontbold);
           p.setSpacingAfter(20);
           p.setAlignment(1); // Center
           return p;
      }
  }
  </code></pre>