我正在尝试使用iTextSharp 5.3.4使用以下内容创建PDF文档
I'm trying to create a pdf document using iTextSharp 5.3.4 using the following
Document document = new Document(); FileStream stm = new FileStream(filename, FileMode.Create); PdfWriter writer = PdfWriter.GetInstance(document, stm);我收到带有以下堆栈跟踪的System.NullReferenceException:
I'm getting a System.NullReferenceException with the following stack trace:
System.NullReferenceException occurred HResult=-2147467261 Message=La référence d'objet n'est pas définie à une instance d'un objet. Source=itextsharp StackTrace: à iTextSharp.text.Version.GetInstance() InnerException:我已经验证文件和stm都不为空,如果我在VS12中选择继续,则会创建文档 - 但是始终抛出异常。 我更新到iTextSharp 5.4.0并且它仍在发生。 我在任何地方找不到任何相关信息 - 任何人都有任何想法?
I've verified that neither document nor stm are null, and if I select "continue" in VS12 the document is created - however the exception is always thrown. I updated to iTextSharp 5.4.0 and it's still occurring. I can't find any information on this anywhere - anyone got any ideas?
推荐答案确保你不是捕捉所有异常。这个 NullReferenceException 很可能是已经在iTextSharp中捕获和处理的那个,所以你不关心它。 事实你可以继续支持这个理论。
Make sure you are not catching all exceptions. This NullReferenceException can very well be one that is already caught and handled inside iTextSharp, so you don't care about it. The fact that you can continue supports this theory.
更改以下设置以验证:
调试 - >例外 - >删除Common Language Runtime Exceptions列中Thrown复选框。
Debug -> Exceptions -> Remove the checkbox in the column "Thrown" of "Common Language Runtime Exceptions".
更多推荐
PdfWriter.GetInstance抛出System.NullReferenceException
发布评论