LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

enscript

convert text files to PostScript for printing

TLDR

Print file to default printer
$ enscript [file]
copy
Generate PostScript output
$ enscript -o [output.ps] [file]
copy
Print two columns
$ enscript -2 [file]
copy
Print with syntax highlighting
$ enscript -E [file.c]
copy
Print landscape
$ enscript -r [file]
copy
Print with header
$ enscript -b "[Header Text]" [file]
copy
Print line numbers
$ enscript -C [file]
copy

SYNOPSIS

enscript [options] [file...]

DESCRIPTION

enscript converts text files to PostScript, HTML, or RTF for printing or viewing. It provides advanced formatting capabilities including multi-column output, headers, footers, and syntax highlighting for numerous programming languages.The tool is widely used for generating professional-looking printouts of source code and documentation. It can automatically detect file types and apply appropriate syntax highlighting, making code more readable when printed.enscript supports customization through configuration files and command-line options, allowing control over fonts, page layout, borders, and output format. It's particularly useful in development environments for code reviews and documentation.

PARAMETERS

-o file

Output to file instead of printer.
-E [lang]
Syntax highlighting.
-2
Two-column output.
-r
Landscape orientation.
-b header
Page header.
-C
Print line numbers.
-f font
Body font.
-F font
Header font.
-p printer
Select printer.
--color
Color output.

CONFIGURATION

/etc/enscript.cfg

System-wide configuration file for default settings.
~/.enscriptrc
User-specific configuration file for personal preferences.

INSTALL

sudo apt install enscript
copy
sudo dnf install enscript
copy
sudo pacman -S enscript
copy
sudo apk add enscript
copy
sudo zypper install enscript
copy
brew install enscript
copy
nix profile install nixpkgs#enscript
copy

SEE ALSO

lpr(1)

Copied to clipboard
Kai