title: How to create editable field in PDF using iText
body: <p>1) First I tried following.Below code is creates second column of the table editable,however I want to have values of myVO.getClientAuthorized() and myVO.getClientSize() also in second column in respective two rows,but with following code I am not getting any value in second column.</p>
  
  <pre><code>public PdfPTable createTable(MyVO myVO){
              PdfPTable table = null;
  
              table = new PdfPTable(2);
              table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
              PdfPCell cell;
              cell = new PdfPCell(new Phrase(
                      myVO.getClientAuthorizedLbl()));
              table.addCell(cell);
              cell = new PdfPCell();
              cell.setCellEvent(new MyCellField(myVO
                      .getClientAuthorized()));
              table.addCell(cell);
              cell = new PdfPCell(new Phrase(
                      myVO.getClientSizeLbl()));
              table.addCell(cell);
              cell = new PdfPCell();
              cell.setCellEvent(new MyCellField(myVO
                      .getClientSize()));
              table.addCell(cell);
  
              return table;
  }
  
  
  class MyCellField implements PdfPCellEvent {
          protected String fieldname;
          public MyCellField(String fieldname) {
              this.fieldname = fieldname;
          }
  
          public void cellLayout(PdfPCell cell, Rectangle rectangle,
                  PdfContentByte[] canvases) {
              final PdfWriter writer = canvases[0].getPdfWriter();
              final TextField textField = new TextField(writer, rectangle,
                      fieldname);
              try {
                  final PdfFormField field = textField.getTextField();
                  writer.addAnnotation(field);
              } catch (final IOException ioe) {
                  throw new ExceptionConverter(ioe);
              } catch (final DocumentException de) {
                  throw new ExceptionConverter(de);
              }
          }
      }
  </code></pre>
  
  <p>2) Then I changed code to below.Basically I replaced </p>
  
  <pre><code>cell = new PdfPCell(); 
  with 
  cell = new PdfPCell(new Phrase(myVO.getClientAuthorized())); 
  and second cell = new PdfPCell(); 
  with 
  cell = new PdfPCell(new Phrase(myVO.getClientSize()));
  
  below is changed code :
  
  public PdfPTable createTable(MyVO myVO){
              PdfPTable table = null;
  
              table = new PdfPTable(2);
              table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
              PdfPCell cell;
              cell = new PdfPCell(new Phrase(
                      myVO.getClientAuthorizedLbl()));
              table.addCell(cell);
              cell = new PdfPCell(new Phrase(myVO.getClientAuthorized()));
              cell.setCellEvent(new MyCellField(myVO
                      .getClientAuthorized()));
              table.addCell(cell);
              cell = new PdfPCell(new Phrase(
                      myVO.getClientSizeLbl()));
              table.addCell(cell);
              cell = new PdfPCell(new Phrase(myVO
                      .getClientSize()));
              cell.setCellEvent(new MyCellField(myVO
                      .getClientSize()));
              table.addCell(cell);
  
              return table;
  }
  
  
  class MyCellField implements PdfPCellEvent {
          protected String fieldname;
          public MyCellField(String fieldname) {
              this.fieldname = fieldname;
          }
  
          public void cellLayout(PdfPCell cell, Rectangle rectangle,
                  PdfContentByte[] canvases) {
              final PdfWriter writer = canvases[0].getPdfWriter();
              final TextField textField = new TextField(writer, rectangle,
                      fieldname);
              try {
                  final PdfFormField field = textField.getTextField();
                  writer.addAnnotation(field);
              } catch (final IOException ioe) {
                  throw new ExceptionConverter(ioe);
              } catch (final DocumentException de) {
                  throw new ExceptionConverter(de);
              }
  
          }
      }
  </code></pre>
  
  <p>Now I am getting text in second column,but it is no more editable.
  Any help please. Thanks in advance.</p>