我正在为 c# 和 ghostscript 使用 ghostscriptsharp 包装器。我想从 pdf 文件中生成缩略图。
从 ghostscript-c-dll "gsdll32.dll" 导入了不同的方法。
[DllImport("gsdll32.dll", EntryPoint = "gsapi_new_instance")]
private static extern int CreateAPIInstance(out IntPtr pinstance,
IntPtr caller_handle);
[DllImport("gsdll32.dll", EntryPoint = "gsapi_init_with_args")]
private static extern int InitAPI(IntPtr instance, int argc, IntPtr argv);
//...and so on
我正在使用 GhostscriptWrapper 在 web 应用程序 (.net 2.0) 中生成缩略图。此类使用上面导入的方法。
protected void Page_Load(object sender, EventArgs e){
GhostscriptWrapper.GeneratePageThumb("c:\\sample.pdf", "c:\\sample.jpg", 1, 100, 100);
}
当我通过按“F5”键在 Visual Studio 2008 中调试 Web 应用程序时,它工作正常(生成了一个新的网络服务器实例)。当我创建一个 WindowsForm 应用程序时,它也可以工作。生成缩略图。
当我直接使用网络浏览器访问应用程序时(http://localhoast/mywebappliation/..)它不起作用。不生成缩略图。但是也没有抛出异常。
我将 gsdll32.dll 放在 windows xp 的 system32 文件夹中。Ghostscript 运行时也已安装。我已授予 IIS-Webproject (.Net 2.0) 的完全访问权限。
有人知道为什么我不能从我的网络应用程序访问 Ghostscript 吗?访问 IIS 服务器上的 dll 文件是否存在任何安全问题?
问候克劳斯