title: iTextSharp appending table to document in memory stream after PDFStamper has been used
body: <p>Hi I am trying to add a table to a pdf after I have used the stamper.</p>
  
  <pre><code>    // CREATE MEMORY STRING 
      MemoryStream ms = new MemoryStream();
  
      string formFile = Server.MapPath("testImg.pdf");      
  
      PdfReader reader = new PdfReader(formFile);
      PdfStamper outStamper = new PdfStamper(reader, ms);
      AcroFields fields = outStamper.AcroFields;
  
      // UPDATE THE FORM FIELDS
      fields.SetField("Text1", "John Smith");
      fields.SetField("Text2", "1234567890");
      fields.SetField("Text3", "1234567890");
  
      //ADD LOGO
      iTextSharp.text.Image headerlogo = iTextSharp.text.Image.GetInstance(Server.MapPath("logo.jpg"));
      headerlogo.ScaleToFit(140, 399);
      headerlogo.Alignment = iTextSharp.text.Image.UNDERLYING;
      headerlogo.SetAbsolutePosition(200, 500);
  
      int pageCount = reader.NumberOfPages;
      PdfContentByte body = outStamper.GetOverContent(pageCount);
  
      body.AddImage(headerlogo);      
  
      outStamper.Close();
  
      Response.ContentType = "application/pdf";
      Response.AddHeader("content-disposition", "attachment;filename=test");
      Response.Buffer = true;
      Response.Clear();
      Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length);
      Response.OutputStream.Flush();
      Response.End();
  </code></pre>
  
  <p>I want to be able to append the document with a table. </p>
  
  <pre><code>        PdfPTable table = new PdfPTable(3);
          PdfPCell cell = new PdfPCell(new Phrase("Header spanning 3 columns"));
          cell.Colspan = 3;
          cell.BorderWidth = 5;
          cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
          table.AddCell(cell);
          table.AddCell("Col 1 Row 1");
          table.AddCell("Col 2 Row 1");
          table.AddCell("Col 3 Row 1");
          table.AddCell("Col 1 Row 2");
          table.AddCell("Col 2 Row 2");
          table.AddCell("Col 3 Row 2");
          document.Add(table);
  </code></pre>
  
  <p>I am having trouble with defining the document to add the table to. Please can someone advise how I would add the table to the PDF in the Memory Stream.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Alex           </p>