首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使用成绩单生成pdf文件而不是ps文件?

如何使用成绩单生成pdf文件而不是ps文件?
EN

Unix & Linux用户
提问于 2018-09-20 18:03:37
回答 1查看 4K关注 0票数 8

我想知道为什么下面的文件生成一个ps文件而不是pdf文件?我如何使它生成一个pdf文件?谢谢。

代码语言:javascript
运行
复制
$ 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

我已经安装了cups

代码语言:javascript
运行
复制
sudo apt install cups-pdf
EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2018-09-20 18:40:10

默认情况下,enscript只生成postscipt文件(ps)。

命令行缺少两个标志:小-p和大写-P。命令行必须如下所示:

代码语言:javascript
运行
复制
enscript -B -P  code/bloom.c -p myfile.ps

enscript 命令页

代码语言:javascript
运行
复制
-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文件,如下所示:

代码语言:javascript
运行
复制
sudo apt install ghostscript
ps2pdf myfile.ps myfile.pdf

代码语言:javascript
运行
复制
enscript file -o - | ps2pdf - output.pdf

如果pdf打印机在系统中是默认的,那么像这样的命令将输出pdf文件而不是ps文件:

代码语言:javascript
运行
复制
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 && 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.
票数 10
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/470364

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档