参照フォントを含む PDF があり、Ghost4J を使用して埋め込みフォントを含む PDF を出力したいと考えています。
public void execute() {
Ghostscript gs = Ghostscript.getInstance();
String[] cmdStr={
"-dNOPAUSE","-dBATCH","-dCompatibilityLevel=1.4",
"-dPDFSETTINGS=/prepress","-dSAFER","-dNOPLATFONTS",
"-sDEVICE=display","-sPAPERSIZE=letter",
"-I","C:\\WINNT\\Fonts\\;C:\\Program Files\\gs\\gs9.05\\lib\\;C:\\Program Files\\gs\\gs9.05\\bin\\;",
"-dSubsetFonts=true","-dEmbedAllFonts=true",
"-sFONTPATH=C:\\WINNT\\Fonts", "-sOutputFile=",
outputPath,"-c",".setpdfwrite", "-f",inputPath
};
try {
gs.initialize(cmdStr);
gs.exit();
} catch (GhostscriptException e) {
System.out.println("ERROR: " + e.getMessage());
e.printStackTrace();
}
PDFを実行すると、次のエラーが発生します。
ERROR: Cannot initialize Ghostscript interpreter. Error code is -100
コマンドラインで実行すると、引数は正しく機能します。
gswin32c.exe -dNOPAUSE -dBATCH -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dSafer -NOPLATFONTS -sDEVICE=pdfwrite -sPAPERSIZE=letter -dSubsetFonts=true -dEmbedAllFonts=true -sFONTPATH=C:\\WINNT\\Fonts -sOutputFile=c:\out.pdf -f c:\test.pdf
フォローアップ:
- GhostScript には C: への書き込み権限があります。
- outputPath、"-f"、inputPath 以外のすべてのスイッチを削除しましたが、それでもエラーが発生します
- inputPath の後の cmdStr の末尾にあるコンマを削除しました
ノート:
- コールバックの取得に取り組んでいます