Create PDF in memory instead of physical file

Switch the filestream with a memorystream.

MemoryStream memStream = new MemoryStream();
PdfWriter wri = PdfWriter.GetInstance(doc, memStream);
...
return memStream.ToArray();

Leave a Comment