Returning iTextSharp PDF as memorystream causes StreamNotSupported

后端 未结 2 1641
半阙折子戏
半阙折子戏 2020-11-30 14:36

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

2条回答
  •  误落风尘
    2020-11-30 15:08

    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:

    PdfWriter writer = new PdfWriter(stream);
    writer.SetCloseStream(false);
    

提交回复
热议问题