我有几个存储在字节数组集合的pdf文件的二进制文件。Abcpdf抛出System.ExecutionEngineException
我的目标是使用abcpdf将它们连接成单个.pdf文件,然后将新创建的文件流式传输到ASP.Net网站页面上的Response对象。
一直在做这样的:
BEGIN LOOP ...
'Create a new Doc
Dim doc As Doc = New Doc
'Read the binary of the current PDF
doc.Read(bytes)
'Append to the master merged PDF doc
_mergedPDFDoc.Append(Doc)
END LOOP
正在工作的时间细95%。然而,现在然后,创建一个新的Doc对象会抛出一个System.ExecutionEngineException并导致CLR崩溃。它似乎没有涉及大量的pdf(有时会发生w /只有2),或与大尺寸的pdf。这似乎几乎是完全随机的。
这是在abcpdf中描述(不是很好)在这里Item 6.24已知的bug。我遇到了a helpful SO post,它建议对abcpdf Doc对象使用Using块。
所以,现在我这样做:
Using doc As New Doc
'Read the binary of the current PDF
doc.Read(bytes)
'Append to the master merged PDF doc
_mergedPDFDoc.Append(doc)
End Using
而且我还没有看到这个问题再次发生呢,并已作为最敲着一个测试版,我可以得到它。
有没有人有类似的经验,这个错误?这是否解决了它?
FWIW我不知道如何解决这个错误,或者如果'使用'将继续停止它,但我使用iTextSharp PDF库几乎是相同的事情,并没有任何问题(并且我添加100个文档在一起) – CResults 2010-04-03 08:45:07