gpt4 book ai didi

java - 无法加载库 'gsdll32'

转载 作者:搜寻专家 更新时间:2023-10-31 08:09:16 24 4
gpt4 key购买 nike

我正在运行以下代码,使用 Ghost4j 从 pdf 创建 bmp 图像

我有一个由 GhostScript 生成器执行的命令,用于从 pdf 生成页面的 Bmp 图像。代码是:

package ghost;

import net.sf.ghost4j.Ghostscript;
import net.sf.ghost4j.GhostscriptException;

public class GhostDemo {
public static void main(String[] a){
Ghostscript gs = Ghostscript.getInstance(); //create gs instance
String[] gsArgs = new String[10];/*command string array*/
gsArgs[0] = "-dUseCropBox";/*use crop box*/
gsArgs[1] = "-dNOPAUSE";
gsArgs[2] = "-dBATCH";
gsArgs[3] = "-dSAFER";
gsArgs[3] = "-r300";
gsArgs[4] = "-sDEVICE=bmp16m";
gsArgs[6] = "-dTextAlphaBits=4";
gsArgs[5] = "-sOutputFile=C:/PagesWorkspace/1/masterData/1.bmp";/*bmp file location with name*/
gsArgs[6] = "C:/MasterWorkspace/pipeline.pdf";/*pdf location with name*/

try {

gs.initialize(gsArgs); /*initialise ghost interpreter*/
gs.exit();

} catch (GhostscriptException e) {
e.printStackTrace();
}
}
}

我遇到了异常

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'gsdll32': The specified module could not be found.

at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:145)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:188)
at com.sun.jna.Library$Handler.<init>(Library.java:123)
at com.sun.jna.Native.loadLibrary(Native.java:255)
at com.sun.jna.Native.loadLibrary(Native.java:241)
at net.sf.ghost4j.GhostscriptLibraryLoader.loadLibrary(GhostscriptLibraryLoader.java:36)
at net.sf.ghost4j.GhostscriptLibrary.<clinit>(GhostscriptLibrary.java:32)
at net.sf.ghost4j.Ghostscript.initialize(Ghostscript.java:292)
at ghost.GhostDemo.main(GhostDemo.java:22)

谁能告诉我为什么会出现此异常?

最佳答案

你有安装 Ghostscript 吗?

  • 如果是,是哪个版本?
  • 如果是,在哪个位置?
  • 它是否包含文件 gsdll32.dll

如果没有,download the Ghostscript installer for Win32并运行它。安装后,目录%your_install_dir%\gs\gs9.05\bin\

中应该有一个文件 gsdll32.dll

关于java - 无法加载库 'gsdll32',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11061709/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com