在 Visual Studio 2013 中使用 nuget,我将Ghostscript.NET安装到我的 Windows x64 PC 上的项目中。
为了确保我没有发疯,我检查了它:
PM> Install-Package Ghostscript.NET
'Ghostscript.NET 1.2.0' already installed.
Project already has a reference to 'Ghostscript.NET 1.2.0'.
PM>
该项目被多个开发人员使用。它针对任何 CPU,并且需要保持这种状态。
这是我的代码:
public static void GhostscriptNetProcess(String fileName, String outputPath)
{
var version = GhostscriptVersionInfo.GetLastInstalledVersion();
var source = (fileName.IndexOf(' ') == -1) ? fileName : String.Format("\"{0}\"", fileName);
var output_file = (outputPath.IndexOf(' ') == -1) ? outputPath : String.Format("\"{0}\"", outputPath);
var gsArgs = new List<String>();
gsArgs.Add("-q");
gsArgs.Add("-dNOPAUSE");
gsArgs.Add("-dNOPROMPT");
gsArgs.Add("-sDEVICE=pdfwrite");
gsArgs.Add(String.Format(@"-sOutputFile={0}", output_file));
gsArgs.Add("-f");
gsArgs.Add(source);
var processor = new GhostscriptProcessor(version, false);
processor.Process(gsArgs.ToArray());
}
每当我尝试调试应用程序时,都会收到以下错误消息:
GhostscriptLibraryNotInstalledException 未处理
Ghostscript.NET.dll 中出现“Ghostscript.NET.GhostscriptLibraryNotInstalledException”类型的未处理异常
附加信息:此托管库在 32 位进程下运行,需要在此机器上安装 32 位 Ghostscript 本机库!要下载适当的 Ghostscript 本机库,请访问:http ://www.ghostscript.com/download/gsdnld.html
查找Ghostscript.NET.GhostscriptLibraryNotInstalledException并没有提供任何有用的信息,尽管CodeProject 上的这篇文章表明调试器在 32 位模式下运行,而我安装了 64 位版本。