title: PDF header signature not found, iText
body: <p>Hi I am trying to read a PDF file which is being uploaded by the servlet. </p>
  
  <p>Here is the code </p>
  
  <pre><code>//out = byte array
  out = readInItem(item);
  fileToUpload = new ByteArrayInputStream(out.toByteArray());
  
  Map&lt;String, AcroFields.Item&gt; pdfBoxNames = new HashMap&lt;String, AcroFields.Item&gt;();
  PdfReader reader = new PdfReader(fileToUpload);
  ByteArrayOutputStream os = new ByteArrayOutputStream();
  PdfStamper stamper = new PdfStamper(reader, os);
  AcroFields acroFields = stamper.getAcroFields();
  pdfBoxNames = acroFields.getFields();
  </code></pre>
  
  <p>My pdf starts like this %PDF-1.6</p>
  
  <p>Error message is 
  java.io.IOException: PDF header signature not found.</p>