
システム:Ubuntu 16.04 64ビット。コードここ
gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=newfile.pdf badfile.pdf
出力:
使用法:gs ... - file.ps arg1 ... argn
期待される出力: 新しい.pdfファイル。
セカンドバージョン
gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=newfile.ps badfile.pdf
上記と同じ出力。
ラスケス。私はGhostscript Editorを実行してGPLを取得しますgs
。コマンドはをtype -a gs
提供します。私のシステムのGhostscriptも同じです。gs is /usr/bin/gs
dpkg-query -s ghostscript | grep Version
Version: 9.18~dfsg~0-0ubuntu2
gs
gs
コマンドが失敗するのはなぜですか?
答え1
答え2
エラーメッセージによると、ghostscript
Ubuntu 16.04では実際には実行されていません。
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"
Ghostscript 9.18の使用:
# dpkg-query -s ghostscript | grep Version
Version: 9.18~dfsg~0-0ubuntu2
コマンド例を実行すると、次の標準のGhostscriptエラーメッセージが表示されます。
GPL Ghostscript 9.18 (2015-10-05)
Copyright (C) 2015 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /undefinedfilename in (badfile.pdf)
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1196/1684(ro)(G)-- --dict:0/20(G)-- --dict:78/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 9.18: Unrecoverable error, exit code 1
gs
確認すべき事項は次のとおりです$PATH
。
自分で実行するとプロンプトが
gs
表示されますか?GS>
# gs GPL Ghostscript 9.18 (2015-10-05) Copyright (C) 2015 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. GS>
type -a gs
ディスプレイですかgs is /usr/bin/gs
、それとも別のものですか?/usr/bin/gs
他の動作を引き起こす代わりに明示的に実行しますかgs
?