C# で GhostScript を使用していますが、正常に動作していますが、特定の PDF ファイルで動作しない理由がわかりません。そして、GhostScript api を調べたところ、この PDF ファイル Click here to Downloadの最後のページでのみ問題が発生していることがわかりました。
GhostScript ランタイム バージョン: v4.0.30319
ゴーストスクリプトのバージョン: 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 を取得します。エラー画像は次のとおりです。