title: iText Error: java.io.IOException: trailer not found
body: <p>I'm creating a web application which will fill a PDF form using iText.  To create the PDF forms I'm first using Microsoft Word to create a template, saving it, then opening that file in Adobe Acrobat Xi Pro, adding my form fields, and saving it as a PDF.  The problem is the PDF is not saving with a trailer so when I execute this:</p>
  
  <pre><code>PdfReader reader = new PdfReader(templateName);
  </code></pre>
  
  <p>It throws an exception "java.io.IOException: trailer not found".  I know I can read a PDF if it has a trailer because I've tried reading other PDFs.  So it appears the issue is that Acrobat is not adding a trailer to my PDF.  Even if I try creating a PDF form from scratch in Acrobat it is not saved with a trailer.</p>
  
  <p>Has anyone else run into this problem?  Is there some setting in Acrobat that will add the trailer?  Is there a way to get iText to read it without the trailer?</p>
  
  <p>====UPDATE====</p>
  
  <p>I must have had an old version of iText because when I downloaded the latest version I was able to read my PDF file.  However after reading the file and stamping it I got an exception closing the stamper.  The code looks like this:</p>
  
  <pre><code>PdfReader reader = new PdfReader(templateName);
  FileOutputStream os = new FileOutputStream(outputPath);
  PdfStamper stamper = new PdfStamper(reader, os);
  AcroFields acroFields = stamper.getAcroFields();
  
  List&lt;String&gt; fields = getFieldNames(getContextCd());
  for (String field : fields) {
      acroFields.setField (field, StringUtil.checkEmpty(request.getParameter(field)));
  }
  
  stamper.setFormFlattening(true);
  stamper.close();
  </code></pre>
  
  <p>The error I got was:</p>
  
  <p>java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
      at com.itextpdf.xmp.impl.XMPMetaParser.createDocumentBuilderFactory(XMPMetaParser.java:423)
      at com.itextpdf.xmp.impl.XMPMetaParser.(XMPMetaParser.java:71)
      at com.itextpdf.xmp.XMPMetaFactory.parseFromBuffer(XMPMetaFactory.java:167)
      at com.itextpdf.xmp.XMPMetaFactory.parseFromBuffer(XMPMetaFactory.java:153)
      at com.itextpdf.text.pdf.PdfStamperImp.close(PdfStamperImp.java:337)
      at com.itextpdf.text.pdf.PdfStamper.close(PdfStamper.java:208)</p>
  
  <p>The only jar file I added to my classpath is itextpdf-5.5.2.jar.  Do I need any of the other jars?</p>