MemoryStream ms = new MemoryStream();PdfWriter writer = PdfWriter.GetInstance(pDoc, ms); var file = System.IO.Path.GetTempFileName(); using (var fileStream = File.OpenWrite(file)) { var buffer = ms.GetBuffer(); fileStream.Write(buffer, 0, (int)buffer.Length); }
writer = PdfWriter.GetInstance(doc, new FileStream(filpath, FileMode.Create));