private static void
   writeTable(PdfWriter __writer)
      throws BadElementException, DocumentException, IOException
      {
         PdfContentByte canvas = __writer.getDirectContent();
         canvas.saveState();
         canvas.setLineWidth(0.1f);

         float origin_x    = 50f;
         float origin_y    = 700f;
         float cell_width  = 40f;
         float cell_height = 40f;

         // the gap size between each cell borders.
         float separator = 3f;
         for (int i=0; i <= 5; i++)
            {
               for (int j=0; j <= 3; j++)
                  {
                     if (i < 5)
                        {
                           // Horizontal line
                           canvas.moveTo( origin_x+separator+    i*cell_width, origin_y+j*cell_height);
                           canvas.lineTo( origin_x-separator+(i+1)*cell_width, origin_y+j*cell_height);
                           canvas.stroke();
                        }

                     if (j < 3)
                        {
                           // Vertical Line
                           canvas.moveTo( origin_x+i*cell_width, origin_y+separator+    j*cell_height);
                           canvas.lineTo( origin_x+i*cell_width, origin_y-separator+(j+1)*cell_height);
                           canvas.stroke();
                        }
                  }
            }

         BaseFont bf = BaseFont.createFont();

         canvas.beginText();
         canvas.setFontAndSize(bf, 12);
         for (int i=0; i<5; i++)
            {
               for (int j=0; j<3; j++)
                  {
                     canvas.showTextAligned(Element.ALIGN_CENTER, (3-j)+""+(i+1), origin_x+cell_width*i+cell_width/2f, origin_y+cell_height*j+cell_height/2.5f, 0);
                  }
            }
         canvas.endText();

         canvas.restoreState();
      }