mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-23 21:20:42 +08:00
translated
This commit is contained in:
parent
180844ee1f
commit
6397b3ad47
@ -1,44 +0,0 @@
|
||||
Linux FAQs with Answers--How to convert a text file to PDF format on Linux
|
||||
================================================================================
|
||||
> **Question**: I want to convert a plain text file into a PDF document. Is there an easy way to convert a text file to a PDF file from the command line on Linux?
|
||||
|
||||
When you have a bunch of text documents to maintain, there are advantages in converting them into PDF format. For example, PDF is good for printing because PDF documents have pre-defined layout. Besides, with PDF format, there is less risk hat the documents are accidentally modified.
|
||||
|
||||
To convert a text file to PDF format, you can follow two-step procedures.
|
||||
|
||||
### Prerequisites ###
|
||||
|
||||
First, you need to install two prerequisite packages.
|
||||
|
||||
On Debian, Ubuntu or Linux Mint:
|
||||
|
||||
$ sudo apt-get install enscript ghostscript
|
||||
|
||||
On Fedora, CentOS/RHEL:
|
||||
|
||||
$ sudo yum install enscript ghostscript
|
||||
|
||||
On Arch Linux:
|
||||
|
||||
$ sudo pacman -S enscript ghostscript
|
||||
|
||||
### Convert a Text File to PDF Format ###
|
||||
|
||||
Once all prerequisites are installed, follow these two steps to generate a PDF file from a text file.
|
||||
|
||||
First, convert a text file to Postscript format by using enscript command-line tool.
|
||||
|
||||
$ enscript -p output.ps input.txt
|
||||
|
||||
Finally convert the generated postscript file to a PDF file.
|
||||
|
||||
$ ps2pdf output.ps output.pdf
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://ask.xmodulo.com/convert-text-to-pdf-linux.html
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
@ -0,0 +1,45 @@
|
||||
Linux FAQs with Answers--How to convert a text file to PDF format on Linux
|
||||
Linux 有问必答 --如何在Linux上将文本文件转换成PDF格式
|
||||
================================================================================
|
||||
> **提问**: 我想要将一个纯文本文件转换成PDF文档。是否有一个简单的方法在Linux命令行下将文本文件转换成PDF文件?
|
||||
|
||||
当你有一打文本文件要维护的时候,把它们转换成PDF文档有一些好处。比如,PDF对打印更友好因为PDF文档有预定义布局。除此之外,还可以减少文档被意外修改的风险。
|
||||
|
||||
要将文本文件转换成PDF格式,你要按照下面的两步。
|
||||
|
||||
### 准备工作 ###
|
||||
|
||||
首先你要安装两个需要的包。
|
||||
|
||||
在 Debian、Ubuntu 或者 Linux Mint上:
|
||||
|
||||
$ sudo apt-get install enscript ghostscript
|
||||
|
||||
在 Fedora、CentOS/RHEL上:
|
||||
|
||||
$ sudo yum install enscript ghostscript
|
||||
|
||||
在 Arch Linux上:
|
||||
|
||||
$ sudo pacman -S enscript ghostscript
|
||||
|
||||
### 将文本文件转换成PDF格式 ###
|
||||
|
||||
准备工作完成之后,按照下面的两步从文本文件生成一个PDF文件
|
||||
|
||||
首先,将文本文件使用enscript命令行工具转换成postscript格式。
|
||||
|
||||
$ enscript -p output.ps input.txt
|
||||
|
||||
最后将postscript格式文件转换成PDF文件。
|
||||
|
||||
$ ps2pdf output.ps output.pdf
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://ask.xmodulo.com/convert-text-to-pdf-linux.html
|
||||
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
Loading…
Reference in New Issue
Block a user