下面使用 PDFNet nuget包 (v6.8.56.6513) 将 PDF 文档转换为 XOD 的代码会引发异常。但是,nuget 包的先前版本(v6.8.2.65223)可以正常工作。要产生问题,请下载此文件。
平台:.Net Framework v4.7.2,x64。
using System;
using pdftron;
namespace PdfTronTest2
{
class Program
{
private static PDFNetLoader loader = PDFNetLoader.Instance();
static void Main(string[] args)
{
try
{
PDFNet.Initialize();
pdftron.PDF.Convert.ToXod("art of unit testing.pdf", "art of unit testing.xod");
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}
例外:
System.AccessViolationException
HResult=0x80004003
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=<Cannot evaluate the exception source>
StackTrace:
at trn.PDF.Convert.ToSilverlight(UString* , UString* , Obj* , Boolean )
at pdftron.PDF.Convert.ToXod(String in_filename, String out_filename)
at PdfTronTest2.Program.Main(String[] args) in C:\Users\mvinchhi\source\repos\PdfTronTest2\PdfTronTest2\Program.cs:line 15