Getting started with Linux: how to convert text files to PDF files in Linux

Source: Internet
Author: User
Tags arch linux linux mint

Getting started with Linux: how to convert text files to PDF files in Linux

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

It is better to convert a large number of text files to PDF files for maintenance. For example, PDF is more suitable for printing because PDF documents have predefined la S. In addition, the document may be accidentally modified.

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

Preparations

First, install two required packages.

On Debian, Ubuntu, or Linux Mint:

  1. $ Sudo apt-get install enscript ghostscript

On Fedora, CentOS/RHEL:

  1. $ Sudo yum install enscript ghostscript

On Arch Linux:

  1. $ Sudo pacman-S enscript ghostscript
Convert a text file to a PDF file

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 to a postscript format.

  1. $ Enscript-p output. ps input.txt

Finally, convert a postscript file into a PDF file.

  1. $ Ps2pdf output. ps output.pdf

How to Use LibreOffice to convert docx, DOC, RTF, and ODT to PDF

This article permanently updates the link address:

Related Article

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.