title: ItextSharp Expected a Dict Object When trying to print
body: <p>I have a web page that allows a user to view a pdf and print pdf. The print pdf is a copy of the display pdf and i am using ItextSharp to inject the javascript to allow auto printing. I have a method that allows a user to upload a pdf and it calls this method below to copy the display copy into a pdf. Both pdf's are then saved in the database. However , when a user goes to click on the print button on my web page they receive the following error "expected a dict object". below is my code that adds in the auto print, which works fine for me but not on my clients site. </p>
  
  <p>I am doing anything wrong that could be corrupting the file. The original pdf content is passed in as a Binary Object.</p>
  
  <p>Any help on this is much appreciated as i am highly confused on this one. Also i am using ASP.NET MVC2.</p>
  
  <pre><code>MemoryStream originalPdf = new MemoryStream(Content.BinaryData);    
  MemoryStream updatedPdf = new MemoryStream();  
  updatedPdf.Write(Content.BinaryData,0, Content.BinaryData.Length);  
  PdfReader pdfReader = new PdfReader(originalPdf);  
  PdfStamper pdfStamper = new PdfStamper(pdfReader, updatedPdf);    
  
  if (autoPrinting)
  {
      pdfStamper.JavaScript = "this.print(true);\r";
  }
  else
  {
      pdfStamper.JavaScript = null;
  }
  
  pdfStamper.Close();
  pdfReader.Close();
  
  Content.BinaryData = updatedPdf.ToArray();
  </code></pre>