0

我正在使用下面的 ghost 4j java api 来转换 PS 文件 PDF 文件,我正在创建一个 pdf 文件,但没有从 ps 文件复制数据。

错误信息如下

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.commons.io.IOUtils;
import org.ghost4j.converter.PDFConverter;
import org.ghost4j.document.PSDocument;

public class PDFConverterExample {
        public static void main(String[] args) {
        FileOutputStream fos = null;
        try {
            PSDocument document = new PSDocument();
            document.load(new File("C:\\Users\\user\\Downloads\\sample.ps"));
            fos = new FileOutputStream(new File("C:\\Users\\user\\Downloads\\sample.pdf"));
            PDFConverter converter = new PDFConverter();
            converter.setPDFSettings(PDFConverter.OPTION_PDFSETTINGS_PREPRESS);
            converter.convert(document, fos);
            int h = converter.getPDFSettings();
        } catch (Exception e) {
            System.out.println("ERROR: " + e.getMessage());
        } finally {
            try {
                fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'gsdll64': Native library (win32-x86-64/gsdll64.dll) `not found in resource path (F:\Rao\Seleneseworkspac\PSPDF\bin;C:\Users\user\Downloads\Adobe Jars\adobe-convertpdf-client-11.0.0.jar;C:\Users\user\Downloads\Adobe Jars\adobe-distiller-client-11.0.0.jar;C:\Users\user\Downloads\Adobe Jars\adobe-forms-client-11.0.0.jar;C:\Users\user\Downloads\Adobe Jars\adobe-generatepdf-client-11.0.0.jar;C:\Users\user\Downloads\Adobe Jars\adobe-livecycle-client-11.0.0.jar;C:\Users\user\Downloads\Adobe Jars\adobe-livecycle-cq-integration-api-1.1.10.jar;C:\Users\user\Downloads\Adobe Jars\adobe-pdfutility-client-11.0.0.jar;C:\Users\user\Downloads\Adobe Jars\adobe-usermanager-client-11.0.0.jar;C:\Users\user\Downloads\Adobe Jars\jboss-client-4.0.2`.jar;C:\Users\user\Downloads\commons-io-2.6-bin\commons-io-2.6\commons-io-2.6.jar;C:\Users\user\Downloads\commons-io-2.6-bin\commons-io-2.6\commons-io-2.6-javadoc.jar;C:\Users\user\Downloads\commons-io-2.6-bin\commons-io-2.6\commons-io-2.6-sources.jar;C:\Users\user\Downloads\commons-io-2.6-bin\commons-io-2.6\commons-io-2.6-tests.jar;C:\Users\user\Downloads\commons-io-2.6-bin\commons-io-2.6\commons-io-2.6-test-sources.jar;C:\Users\user\Downloads\ghost4j-1.0.1\lib\commons-beanutils-1.9.2.jar;C:\Users\user\Downloads\ghost4j-1.0.1\lib\commons-collections-3.2.1.jar;C:\Users\user\Downloads\ghost4j-1.0.1\lib\commons-io-1.3.1.jar;C:\Users\user\Downloads\ghost4j-1.0.1\lib\commons-logging-1.1.1.jar;C:\Users\user\Downloads\ghost4j-1.0.1\lib\itext-2.1.7.jar;C:\Users\user\Downloads\ghost4j-1.0.1\lib\jna-4.1.0.jar;C:\Users\user\Downloads\ghost4j-1.0.1\lib\log4j-`1.2.17.jar;C:\Users\user\Downloads\ghost4j-1.0.1\lib\xmlgraphics-commons-1.4.jar;C:\Users\user\Downloads\ghost4j-1.0.1\ghost4j-1.0.1.jar)`
    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:271)
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
    at com.sun.jna.Library$Handler.<init>(Library.java:147)
    at com.sun.jna.Native.loadLibrary(Native.java:412)
    at com.sun.jna.Native.loadLibrary(Native.java:391)
    at org.ghost4j.GhostscriptLibraryLoader.loadLibrary(GhostscriptLibraryLoader.java:39)
    at org.ghost4j.GhostscriptLibrary.<clinit>(GhostscriptLibrary.java:37)
    at org.ghost4j.Ghostscript.initialize(Ghostscript.java:323)
    at org.ghost4j.converter.PDFConverter.run(PDFConverter.java:231)
    at 

org.ghost4j.converter.AbstractRemoteConverter.convert(AbstractRemoteConverter.java:85)
at PDFConverterExample.main(PDFConverterExample.java:31)
4

0 回答 0