paps Command in Linux



The paps command in Linux converts the UTF-8 to Postscript using Pango. Pango is a library designed to lay out and render text. It provides advanced text layout capabilities and is widely used in graphical user interfaces (GUIs) and text rendering systems, particularly in the Linux and Unix ecosystems.

The paps command processes a UTF-8 encoded file and produces a PostScript representation of its content, utilizing the Pango ft2 backend to generate outline curves for rendering.

Table of Contents

Here is a comprehensive guide to the options available with the paps command −

Installation paps Command

The paps tool may not be available by default on Linux. To install it on Ubuntu, Raspberry Pi OS, Kali Linux, Debian, and Debian-based distributions, use the command given below −

sudo apt install paps

To install it on Arch Linux, use −

sudo pacman -S paps

To install it on CentOS, use the command given below −

sudo yum install paps

To install paps on Fedora, use the following command −

sudo dnf install paps

To verify the installation, check the path of the paps binary using the which command.

which paps
paps Command in Linux1

Syntax of paps Command

The syntax of the Linux paps command is as follows −

paps [options] [file]

The [options] field is used to specify options such as output document layout, margins, and help. The [file] field is used to specify the file that needs to be converted to Postscript.

paps Command Options

The options of the paps command are listed below −

Option Description
--landscape Landscape output (Default is portrait)
--columns=cl Number of columns output (Default is 1)
--font=desc Set the font description (Default is Monospace 12)
--rtl Do rtl layout
--paper ps Choose paper size (Known paper sizes are legal, letter, a4) (Default is A4)
--bottom-margin=bm Set bottom margin in postscript points (1/72 inch) (Default is 36)
--top-margin=tm Set top margin (Default is 36)
--left-margin=lm Set left margin (Default is 36)
--right-margin=rm Set right margin (Default is 36)
--help, -h Showa summary of options
--header Draw page header for each page
--markup Interpret the text as Pango markup
--lpi Set the lines per inch (This determines the line spacing)
--cpi Set the characters per inch (This is an alternative method of specifying the font size)
--stretch-chars Indicates that characters should be stretched in the y-direction to fill up their vertical space (This is similar to the texttops behavior)

Examples of paps Command in Linux

In this section, the usage of the paps command in Linux will be discussed with examples −

Converting a UTF-8 File to PostScript

To convert a UTF-8 file to PostScript use the paps command in the following way −

paps file.txt

The above command converts the file.txt to PostScript and displays the script to standard output.

paps Command in Linux2

To check whether the file is UTF-8 encoded, use the file command −

file -i file.txt
paps Command in Linux3

Converting a UTF-8 File to PostScript and Saving to a Separate File

Use the redirection operator (>) to save the converted PostScript to a file. For example, to save the PostScript conversion of file.txt to file.ps, use the following command −

paps file.txt > file.ps
paps Command in Linux4

Converting a UTF-8 File to PostScript in Landscape Orientation

By default, the output of the paps command is portrait. To change the orientation to landscape, use the --landscape option −

paps --landscape file.txt

Specifying the Number of Columns

To specify the number of columns, use the --column option. For example, to change the number of columns to 2, use the command given below −

paps --columns=2 file.txt

Setting a Specific Font and Size

To set a specific font and size for the output PostScript file, use the --font option −

paps --font="Consolas Bold 14" file.txt

Setting Right to Left Layout

To render the text right to left for languages that are written right to left such as Arabic or Hebrew, use the -rtl option −

paps --rtl file.txt

Setting Margins

To set the margins, use the --right-margin, --left-margin, --top-margin, and --bottom-margin options −

paps --top-margin=30 --bottom-margin=30 --left-margin=10 --right-margin=10 file.txt

Changing Paper Size

To change the paper size, use the --paper option with the size.

paps --paper=letter file.txt

Note that the paper size is A4 by default. Other sizes that can be used are A3, A5, letter, legal, tabloid, and executive.

Adding Header

To add a header to each page, use the --header option −

paps --header file.txt

Adjusting Line Per Inch and Characters Per Inch

To adjust the vertical distance between lines, use the --lpi option −

paps --lpi=10 file.txt

Similarly, to change the characters per inch, use the --cpi option −

paps --cpi=10 file.txt

Displaying Help

To display help about the paps command, use the -h or --help option −

paps --help

Conclusion

The paps command in Linux is a handy tool for converting UTF-8 files to PostScript format using the Pango library. It provides various options for customization, such as changing orientation, font style, margins, and paper size.

The benefits of the paps command make it a useful utility for creating well-structured PostScript documents from text files.

Advertisements