title: How to save PDF using ITextSharp?
body: <p>I working with PDF annotations using ITextSharp. I was able to add annotations pretty smoothly. 
  But now I'm trying to edit them. It looks like my PdfReader object is actually updated. But for some reason I can't save it. As shown in the snippet below, I try to get the byte array from using a stamper. The byte array is only 1 byte longer than the previous version no matter how long is the annotation. And when I open the PDF saved on the file system, I still have the old annotation...</p>
  
  <pre><code>    private void UpdatePDFAnnotation(string title, string body)
      {
          byte[] newBuffer;
          using (PdfReader pdfReader = new PdfReader(dataBuffer))
          {
  
              int pageIndex = 1;
              int annotIndex = 0;
  
              PdfDictionary pageDict = pdfReader.GetPageN(pageIndex);
              var annots = pageDict.GetAsArray(PdfName.ANNOTS);
              if (annots != null)
              {
                  PdfDictionary annot = annots.GetAsDict(annotIndex);
                  annot.Put(PdfName.T, new PdfString(title));
                  annot.Put(PdfName.CONTENTS, new PdfString(body));
              }
  
              // ********************************
              // this line shows the new annotation is in here. Just have to save it somehow !!
              var updatedBody = pdfReader.GetPageN(pageIndex).GetAsArray(PdfName.ANNOTS).GetAsDict(0).GetAsString(PdfName.CONTENTS);
              Debug.Assert(newBody == updatedBody.ToString(), "Annotation body should be equal");
  
  
              using (MemoryStream outStream = new MemoryStream())
              {
                  using (PdfStamper stamp = new PdfStamper(pdfReader, outStream, '\0', true))
                  {
                      newBuffer = outStream.ToArray();
                  }
              }
  
             }
             File.WriteAllBytes( @"Assets\Documents\AnnotedPdf.pdf", newBuffer);
          }
  </code></pre>
  
  <p>Any idea what's wrong with my code?</p>