How to convert a text file to PDF on Linux

Source: Internet
Author: User
Tags arch linux linux mint

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

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

Preparatory work

First, you need to install two required 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 a 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

How to convert text files to PDF format on Linux

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.