enscriptを使ってpsファイルではなくpdfファイルを生成するには?

enscriptを使ってpsファイルではなくpdfファイルを生成するには?

次に、このpdfファイルの代わりにpsファイルを生成する理由を知りたいです。 PDFファイルを生成するにはどうすればよいですか?ありがとうございます。

$ enscript -B -PPDF code/bloom.c -o bloom.pdf 
[ 2 pages * 1 copy ] left in bloom.pdf
$ file bloom.pdf 
bloom.pdf: PostScript document text conforming DSC level 3.0

cup-pdfをインストールしました。

sudo apt install cups-pdf

ベストアンサー1

デフォルトではenscriptPostsciptファイル(ps)のみが生成されます。

コマンドラインに2つのフラグがありません:小さい -pそして首都 -P。コマンドラインは次のようになります。

enscript -B -P <PDF_PRINTER_NAME> code/bloom.c -p myfile.ps

~によるとenscript マンページ

-P name, --printer=name
Spool the output to the printer name.

-p file, --output=file
Leave the output to file file. If the file is `-', enscript sends the output to the standard output stdout.

システムにPDFプリンタがない場合、ゴーストスクリプト次のようにpsファイルをpdfファイルに変換できます。

sudo apt install ghostscript
ps2pdf myfile.ps myfile.pdf

または

enscript file -o - | ps2pdf - output.pdf

システムがデフォルトでpdfプリンタを使用している場合は、次のようなコマンドを実行するとpsファイルではなくpdfファイルが出力されます。

enscript -2 -r -j --font=Times-Roman11 --word-wrap --mark-wrapped=arrow '%f' && sleep 2 && evince ~/PDF/_stdin_.pdf

- The `%f` designates the filename parameter.    
- The `&& sleep 2 &amp;&amp; evince ~/PDF/_stdin_.pdf` commands will wait two seconds for the print job to finish, then run the Evince PDF viewer to display the file _stdin_.pdf you just generated in the user’s PDF subdirectory.

おすすめ記事