title: Can't read some PDF files with iTextSharp
body: <p>I have a Win32 application that reads PDFs using iTextSharp which inserts an image into the document as a seal.</p>
  
  <p>It works fine with 99% of the files we are processing over a year, but these days some files just don't read.
  When I execute the code below:</p>
  
  <pre><code>string inputfile = "C:\test.pdf";
  PdfReader reader = new PdfReader(inputfile);
  </code></pre>
  
  <p>It gives the exception:</p>
  
  <pre><code>System.NullReferenceException occurred
    Message="Object reference not set to an instance of an object."
    Source="itextsharp"
    StackTrace:
         em iTextSharp.text.pdf.PdfReader.ReadPages()
         em iTextSharp.text.pdf.PdfReader.ReadPdf()
         em iTextSharp.text.pdf.PdfReader..ctor(String filename, Byte[] ownerPassword)
         em iTextSharp.text.pdf.PdfReader..ctor(String filename)
         em MyApp.insertSeal() na C:\MyApp\Stamper.cs:linha 659
  </code></pre>
  
  <p>The pdf files that throw these exception can be normally read by adobe pdf and when I open one of these files with Acrobat and save it I can read this saved file with my application. </p>
  
  <p>Are the files corrupted but still can be opened with Adobe Reader?</p>
  
  <p>I am sharing with you two samples of files.</p>
  
  <p>A file that NOT work : <a href="https://docs.google.com/viewer?a=v&amp;pid=explorer&amp;chrome=true&amp;srcid=0B_2HqJuyaiugNWUyOTQyNDUtZWM3OC00Y2Y5LWJkNjctNjc1NmZkMTVlZjU1&amp;hl=pt_BR&amp;authkey=CNWl7qoK" rel="nofollow">Not-Ok-Version.pdf</a></p>
  
  <p>And a file that works, after a opened and saved it with Acrobat. Download it here <a href="https://docs.google.com/viewer?a=v&amp;pid=explorer&amp;chrome=true&amp;srcid=0B_2HqJuyaiugNWUyOTQyNDUtZWM3OC00Y2Y5LWJkNjctNjc1NmZkMTVlZjU1&amp;hl=pt_BR&amp;authkey=CNWl7qoK" rel="nofollow">OK-Version.pdf</a></p>