title: How to extract the data from a pdf File using iText
body: <p>I am working on a program that extracts data from a PDF file and I am using iText as java library. When I try to open the file using this method : </p>
  
  <pre><code>public static void main(String[] args) {
      try {
          // TODO code application logic here
  
          PdfReader pr=new FdfReader("C:\\Users\\saviour\\Desktop\\doc308-999.pdf");
  
          String str=PdfTextExtractor.getTextFromPage(pr, 2); 
          System.out.println(str);
  
      } catch (IOException ex) {
          Logger.getLogger(PDFTests.class.getName()).log(Level.SEVERE, null, ex);
      }
  
  }
  </code></pre>
  
  <p>I have this Error:</p>
  
  <pre><code>com.itextpdf.text.exceptions.InvalidPdfException: FDF header signature not found.
      at com.itextpdf.text.pdf.PRTokeniser.checkFdfHeader(PRTokeniser.java:215)
      at com.itextpdf.text.pdf.FdfReader.readPdf(FdfReader.java:95)
      at com.itextpdf.text.pdf.PdfReader.&lt;init&gt;(PdfReader.java:169)
      at com.itextpdf.text.pdf.PdfReader.&lt;init&gt;(PdfReader.java:158)
      at com.itextpdf.text.pdf.FdfReader.&lt;init&gt;(FdfReader.java:63)
      at pdftests.PDFTests.main(PDFTests.java:39)
  </code></pre>
  
  <p>So I am asking about the purpose of this Exception :)
  Thank you guys.</p>