title: iText Java Table cellspacing
body: <p>i am using a java library iText for generating pdfs. The question is : How can i define a cellspacing in an itext table like <a href="https://www.google.bg/search?q=cellspacing&amp;es_sm=93&amp;source=lnms&amp;tbm=isch&amp;sa=X&amp;ei=JENtU9-zAamKyQP7vIGwBQ&amp;ved=0CAgQ_AUoAQ&amp;biw=1242&amp;bih=546#q=cellspacing%20table&amp;tbm=isch&amp;facrc=_&amp;imgdii=_&amp;imgrc=XQx6WLYumiUKXM%253A;JHJFyvT4JBCwUM;http%253A%252F%252Fwww.dzinemagazine.com%252Fwp-content%252Fuploads%252F2011%252F10%252Fimage12.png;http%253A%252F%252Fwww.dzinemagazine.com%252Fweb-developement%252Fhtml-table-cellspacing-attribute-1463.html;306;297" rel="nofollow">this</a>.</p>
  
  <p>Thank you in advance!    </p>
  
  <p>P.S.:Thats part of my code:</p>
  
  <pre><code>private static PdfPTable createFirstTable() throws DocumentException, IOException {
      PdfPTable table = new PdfPTable(13);
  
       BaseFont baseFont = BaseFont.createFont("times.ttf", BaseFont.IDENTITY_H, true);
       Font deckFont = new Font(baseFont, 12f);
       deckFont.setColor(BaseColor.RED); 
       table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
       table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
       table.getDefaultCell().setPaddingBottom(15);
       table.getDefaultCell().setPaddingTop(15);
  
       Font deckFont1 = new Font(baseFont, 12f);
       deckFont1.setColor(BaseColor.BLACK); 
      for (int i = 0; i &lt; 4; i++) {
          switch (i) {
          case 0:
  
              for (int j = 0; j &lt; 13; j++) {
                  switch (j) {
                  case 0:
                  case 1:
                  case 2:
                  case 3:
                  case 4:
                  case 5:
                  case 6:
                  case 7:
  
  
                      table.addCell(new Paragraph(String.valueOf(j+2+"\u2666"),deckFont));
                      break;
                  case 8:
                      table.addCell(new Paragraph(String.valueOf(j+2+"\u2666"),deckFont));
                      break;
                  case 9:
                      table.addCell(new Paragraph(String.valueOf("J"+"\u2666"),deckFont));
                      break;
                  case 10:
                      table.addCell(new Paragraph(String.valueOf("D"+"\u2666"),deckFont));
                      break;
                  case 11:
                      table.addCell(new Paragraph(String.valueOf("K"+"\u2666"),deckFont));
                      break;
                  case 12:
                      table.addCell(new Paragraph(String.valueOf("A"+"\u2666"),deckFont));
                      break;
                  default:
                      table.addCell("Error case");
                      ;
                      break;
                  }
              }
              table.completeRow();
              break;
  
          case 1:
              for (int j = 0; j &lt; 13; j++) {
                  switch (j) {
                  case 0:
                  case 1:
                  case 2:
                  case 3:
                  case 4:
                  case 5:
                  case 6:
                  case 7:
                      table.addCell(new Paragraph(String.valueOf(j+2+"\u2660"),deckFont1));
                      break;
                  case 8:
                      table.addCell(new Paragraph(String.valueOf(j+2+"\u2660"),deckFont1));
                      break;
                  case 9:
                      table.addCell(new Paragraph(String.valueOf("J"+"\u2660"),deckFont1));
                      break;
                  case 10:
                      table.addCell(new Paragraph(String.valueOf("D"+"\u2660"),deckFont1));
                      break;
                  case 11:
                      table.addCell(new Paragraph(String.valueOf("K"+"\u2660"),deckFont1));
                      break;
                  case 12:
                      table.addCell(new Paragraph(String.valueOf("A"+"\u2660"),deckFont1));
                      break;
                  default:
                      System.out.println("Error case");
                      break;
                  }
              }
  </code></pre>