【发布时间】:2018-09-21 17:15:49
【问题描述】:
我收到异常“文档已损坏,重建失败”, 同时从 MemoryStream 实例化 TallComponents.PDF.Document。
byteResponse 很好。也就是说,文档没有损坏。 但是,我正在循环运行此方法以创建多个 PDF。
我错过了什么吗?我需要做任何额外的检查吗?
using (Stream stream = new MemoryStream(byteResponse, true))
{
var pdf = new TallComponents.PDF.Document(stream);
【问题讨论】:
-
“byteResponse 很好” - 你是怎么测试的?
-
是的,如果我们从具有 MIME 类型 application/pdf 的 Web 应用程序返回相同的字节数组,我们就可以浏览 pdf。但是,无法将相同的字节数组保存为 pdf 文档。我正在循环运行此方法以创建多个 PDF。关闭流或 TallComponent pdf 文档有什么问题吗?
标签: arrays pdf stream pdf-generation memorystream