我正在使用带有 C# 的 GhostScript,它工作正常,但不知道为什么对于某些特定的 PDF 文件它不起作用。我查看了 GhostScript api,发现这个 PDF 文件的最后一页出现的唯一问题 Click here to Download。
GhostScript 运行时版本:v4.0.30319
GhostScript 版本:1.2.0.0
Ghostscript API 中的错误点如下几行。
public int Execute(string[] args)
{
//Some Coding lines here
// call ghostscript
try
{
//This is the Error line on ghostscript api call
result = NativeMethods.gsapi_init_with_args(_ghostScriptInstance, args.Length, _argumentPointersHandle.AddrOfPinnedObject());
}
finally
{
this.FreeHandles();
}
if (result < (int)ErrorCode.Success) // TODO: often if GhostScript fails because you've passed the wrong combination of params etc, it still returns zero... unhelpful
throw new GhostScriptException(result, args);
return result;
}
总是得到 -100 作为错误代码。和错误图像如下。