I\'m creating a PDF file using the PdfStamper in iTextSharp and return the PDF as a memorystream object to the calling function, that is then used to display the PDF in Tele
For iText 7, the syntax has changed a bit from mkl's answer.
You can prevent the writer from closing the stream witht the SetCloseStream() method:
SetCloseStream()
PdfWriter writer = new PdfWriter(stream); writer.SetCloseStream(false);