title: Create PDF in memory instead of physical file
body: <p>How do one create PDF in memorystream instead of physical file using itextsharp.</p>
  
  <p>The code below is creating actual pdf file.</p>
  
  <p>Instead how can I create a byte[] and store it in the byte[] so that I can return it through a function</p>
  
  <pre><code>using iTextSharp.text;
  using iTextSharp.text.pdf;
  Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35);
  PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream("c:\\Test11.pdf", FileMode.Create));
  doc.Open();//Open Document to write
  Paragraph paragraph = new Paragraph("This is my first line using Paragraph.");
  Phrase pharse = new Phrase("This is my second line using Pharse.");
  Chunk chunk = new Chunk(" This is my third line using Chunk.");
  
  doc.Add(paragraph);
  
  doc.Add(pharse);
  
  doc.Add(chunk);
  doc.Close(); //Close document
  </code></pre>