且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

itextSharp数据表转换为pdf base64字符串-pdf损坏

更新时间:2023-11-15 19:54:10

您可以通过关闭文件来在文档完成之前检索文档字节:

You retrieve the document bytes before the document is finished by closing:

        var bytes = memoryStream.ToArray();
        var encodedPDF = Convert.ToBase64String(bytes);

        document.Close();

将关闭调用移到ToArray调用之前.

Move the close call before the ToArray call.