I am using GhostScript with C# and it is working fine but Don't know why with some specific PDF files it is not working. And I looked in GhostScript api and I found that only issue occurring with the last page of this PDF file Click here to Download.
GhostScript Runtime Version : v4.0.30319
GhostScript Version : 1.2.0.0
Error point in Ghostscript API as below lines.
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;
}
Always getting -100 as error code. And Error Image as follow.