在linux下编辑文档,txt格式的方便很多。如果有很多很大的txt文档,为了方便阅读和保存,转换为pdf格式的文件也是一种很不错的方法。
1.工具介绍:
enscript:
https://www.gnu.org/software/enscript/
http://linuxcommand.org/man_pages/enscript1.html
Ghostscript:
http://www.gnu.org/software/ghostscript/
可将postscript 语言解释成pdf格式。
2.工具安装:
在Debian, Ubuntu, Linux Mint上:
brandon@ubuntu:~/shell/Chapter1$ sudo apt-get install enscript ghostscript
在Fedora, Centos, RHEL上:
$sudo yum install enscript ghostscript
使用enscript将txt文本文件转换为postscript格式:
brandon@ubuntu:~/shell/Chapter1$ enscript -p sed_test.ps sed_test.txt
-p file命令是将enscript执行的结果导出到file文件,如果file替换为“-”,则将转换结果输出到标准输出。
使用postscript将转换后的文件再转换为pdf格式:
brandon@ubuntu:~/shell/Chapter1$ ps2pdf sed_test.ps sed_test.pdf
brandon@ubuntu:~/shell/Chapter1$ ls
sed_test.pdf sed_test.ps sed_test.txt