在linux下编辑文档,txt格式的方便很多。如果有很多很大的txt文档,为了方便阅读和保存,转换为pdf格式的文件也是一种很不错的方法。
转载自:https://blog.youkuaiyun.com/fengzei886/article/details/41820655
1.工具介绍:
enscript:
https://www.gnu.org/software/enscript/
http://linuxcommand.org/man_pages/enscript1.html
是一个将文本文件(ASCII)转换为postscript,HTML,RTF的免费软件,可直接打印输出。
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
3.文件转换:
使用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
在Linux系统中,将大量txt文档转换为便于阅读和保存的pdf格式是一种好方法。本文介绍了使用enscript和Ghostscript进行转换的步骤。首先通过enscript将txt转换为postscript格式,然后利用Ghostscript将postscript文件转化为pdf。
929

被折叠的 条评论
为什么被折叠?



