使用 Ghost PCl CreateAPIInstance returns -100 将 PCL 转换为 Tiff

Converting PCL to Tiff using Ghost PCl CreateAPIInstance returns -100

背景:尝试使用 GhostScript 将 PCL 转换为 Tiff。在 c# winforms 应用程序中尝试将 PCL 转换为 Tiff 时出现此错误。

我正在使用来自 https://github.com/mephraim/ghostscriptsharp 的 Matthew 示例。 这是一个很酷的包装器,让我可以访问 GS API。 但是由于某种原因得到这个错误结果是 < 0: 我需要在我的电脑上安装 GS 吗?该样本已经带有 gsdll32.dll 和 gsdll64.dll。我正在尝试转换 PCLToTiff。该示例具有 gsdll64,不包括 gpcl6dll6.dll。 这可能是问题所在吗? gsdll64 是否包含包括 PCL 在内的所有内容?

这是参数。

我也只是通过调用可执行文件在没有包装器的情况下进行了尝试。还没有运气。 我有可执行文件 gs9533w32.exe at C:\Users\tom\Desktop\GhostLib\gs9533w32.exe. 我也有newForm.PCl in the bin Debug folder of the application。 我也尝试使用 gpcl6win64.exe

下次试用: 下一个问题:如果我要购买 GhostPCL 的许可证并将其集成为我们提供的解决方案的一部分,安装将如何进行?是将 exe 和 DLL 放在一个文件夹中然后从那里调用它那么简单,还是涉及一些安装?

我明白了。我只需要为 gpcl6dll6 做一个 DLLImport。包装样本没有 gpcl6dll6。它只有 gsdll 的

 [DllImport("gpcl6dll32.dll", EntryPoint = "gsapi_new_instance")]
    private static extern int CreateAPIInstance(out IntPtr pinstance, IntPtr caller_handle);

    [DllImport("gpcl6dll32.dll", EntryPoint = "gsapi_init_with_args")]
    private static extern int InitAPI(IntPtr instance, int argc, string[] argv);

    [DllImport("gpcl6dll32.dll", EntryPoint = "gsapi_exit")]
    private static extern int ExitAPI(IntPtr instance);

    [DllImport("gpcl6dll32.dll", EntryPoint = "gsapi_delete_instance")]
    private static extern void DeleteAPIInstance(IntPtr instance);
    #endregion