title: How to read pdf form fields using Java?
body: <p>I've a requirement where user are going to fill lots of fields ( text field, check box, radio button ) on pdf form and they will mail us. I need to read each fields on pdf form and insert into oracle table. </p>
  
  <p><strong>Edit1:</strong> I'm trying following code, It generates pdf but when I double click it says "invalid format". What's wrong ?</p>
  
  <pre><code>import java.io.FileOutputStream;
  import java.io.IOException;
  
  import com.itextpdf.text.*;
  import com.itextpdf.text.pdf.PdfWriter;
  
  public class pdfGentest{
      public static void main(String[] args) {
  
          Document document = new Document();
  
          try {
  
              PdfWriter.getInstance(document, new FileOutputStream("c:\\HelloWorld.pdf"));
              document.open();
              document.add(new Paragraph("Hello World"));
              }
          catch (DocumentException de) {
              System.err.println(de.getMessage());
              } catch (IOException ioe) {
                  System.err.println(ioe.getMessage());
              }       
      }
  }
  </code></pre>
  
  <p><strong>Fixed:</strong> Due to I've not closed the document..Adding document.close(); fixed the problem</p>