How to convert plain text documents to PDF under LINUX __linux

Source: Internet
Author: User
Tags text to pdf arch linux linux mint
Now there are a lot of software can convert text files to PDF files, in fact, in Linux, without the use of software can also be converted text text to PDF, just two easy steps, the following small series to give you the introduction of Linux text files to the PDF file method.

Question: I want to convert a plain text file into a PDF document. Is there a simple way to convert a text file to a PDF file under the Linux command line?

When you have a lot of text files to maintain, it's better to convert them to PDF documents. For example, PDFs are more suitable for printing because PDF documents have predefined layouts. In addition, you can reduce the risk of accidental modification of the document.

To convert a text file to PDF format, you should follow the two steps below.

preparatory work

First, you need to install two packages.

On Debian, Ubuntu, or Linux mint:

$ sudo apt-get install enscript Ghostscript

On Fedora, Centos/rhel:

$ sudo yum install enscript Ghostscript

On the Arch Linux:

$ sudo pacman-s enscript Ghostscript

Convert a text file into PDF format

After the preparation is complete, generate a PDF file from the text file in the following two steps

First, use the Enscript command-line tool to convert the text file into PostScript format.

$ enscript-p output.ps Input.txt

Finally, the PostScript format file is converted into a PDF file.

$ ps2pdf output.ps output.pdf

The above is Linux. The steps to convert a text file to a PDF are described here, and you need to use the command-line tools, and you can download the tools for conversion if you're not a very knowledgeable friend on the command line.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.