enscript | Début | Suivant | Sommaire | Préc.page.lue | Accueil |
NAME | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
SYNOPSIS | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
DESCRIPTION | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
Enscript converts text files to PostScript or to other output languages. Enscript can spool the generated output directly to a specified printer or leave it to a file. If no input files are given, enscript processes the standard input stdin. Enscript can be extended to handle different output media and it has many options which can be used to customize the printouts.
OPTIONS | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
The header string header can contain the same formatting escapes which can be specified for the %Format directives in the user defined fancy headers. For example, the following option prints the file name, current data and page numbers:
enscript --header='$n %W Page $% of $=' *.c
The header string can also contain left, center and right justified fields. The fields are separated by the '|' character:
enscript --header='$n|%W|Page $% of $=' *.c
now the file name is printed left justified, the date is centered to the header and the page numbers are printed right justified.
You can also use the --slice option which slices long lines to separate pages.
For example, the command
enscript -DDuplex:true foo.txt
prints file foo.txt in duplex (two side) mode.
Page device operators are implementation dependant but they are standardized. See section PAGE DEVICE OPTIONS for the details.
You can print a short description of the supported highlighting languages and file formats with the command:
enscript --help-highlight
The highlighting rules are defined in the `/usr/share/enscript/st/*.st' files which can be edited to create highlighting definitions for new languages.
Note! You can not use your own input filters with this option.
The font specification name contains two parts: the name of the font and its size in PostScript points. For example, "Times-Roman12" selects the "Times-Roman" font with size 12pt.
The font specification name can also be given in format `name@ptsize', where the name of the font and its point size are separated by a `@' character. This allows enscript to use fonts which contain digit characters in their names.
The font point size can also be given in the format width/height where the width and the height specify the size of the font in x- and y-directions. For example, "Times-Roman@10/12" selects a 10 points wide and 12 points high "Times-Roman" font.
You can also give the font sizes as decimal numbers. For example, "Times-Roman10.2" selects a 10.2pt "Times-Roman" font.
For example, the following command prints the file `foo.c' by using only upper-case characters:
enscript --filter=cat %s | tr 'a-z' 'A-Z' foo.c
The following command highlights changes which are made to files since the last checkout:
enscript --filter=rcsdiff %s | diffpp %s -e *.c
To include the string "%s" to the filter command, you must write it as "%%s".
The statusdict operators are implementation dependant; see the printer's documentation for the details.
For example, the command
enscript -Ssetpapertray:1 foo.txt
prints the file foo.txt by using paper from the paper tray 1 (assuming that the printer supports paper tray selection).
If no text is given, the underlay is not printed. This can be used to remove an underlay text that was specified with the `Underlay' configuration file option.
The PostScript files are recognized by looking up the `%!' magic cookie from the beginning of the file. Note! Enscript recognized also the Windoze damaged `^D%!' cookie.
The PCL files are recognized by looking up the `^[E' or `^[%' magic cookies from the beginning of the file.
CONFIGURATION FILES | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
Enscript reads configuration information from the following sources (in this order): command line options, environment variable ENSCRIPT, user's personal configuration file ($HOME/.enscriptrc), site configuration file (/etc/enscriptsite.cfg) and system's global configuration file (/etc/enscript.cfg).
The configuration files have the following format:
Empty lines and lines starting with `#' are comments.
All other lines are option lines and have format:
option [arguments ...].
The following options can be specified:
User can select this media with option -M name.
FANCY HEADERS | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
Users can create their own fancy headers by creating a header description file and placing it in a directory which is in enscript's library path. The name of the header file must be in format: `headername.hdr'. Header can be selected by giving option: --fancy-header=headername.
Header description file contains PostScript code that paints the header. Description file must provide procedure do_header which is called by enscript at the beginning of every page.
Header description file contains two parts: comments and code. Parts are separated by a line containing text:
% -- code follows this line --
Enscript copies only the code part of description file to the generated PostScript output. The comments part can contain any data, it is not copied. If separator line is missing, no data is copied to output.
Enscript defines following constants which can be used in header description files:
You can also use the following special comments to customize your headers and to specify some extra options. Special comments are like DSC comments but they start with a single `%' character; special comments start from the beginning of the line and they have the following syntax:
%commentname: options
Currently enscript support the following special comments:
escape width directive
where width specifies the width of the column to which the escape is printed. For example, escape "$5%" will expand to something like " 12". If the width is negative, the value will be printed left-justified.
For example, the `emacs.hdr' defines its date string with the following format comment:
%Format: eurdatestr %E
which expands to:
/eurdatestr (96/01/08) def
According to Adobe's Document Structuring Conventions (DSC), all resources needed by a document must be listed in document's prolog. Since user's can create their own headers, enscript don't know what resources those headers use. That's why all headers must contain a standard DSC comment that lists all needed resources. For example, used fonts can be listed with following comment:
%%DocumentNeededResources: font fontname1 fontname2
Comment can be continued to the next line with the standard continuation comment:
%%+ font fontname3
SPECIAL ESCAPES | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
Enscript supports special escape sequences which can be used to add some page formatting commands to ASCII documents. As a default, special escapes interpretation is off, so all ASCII files print out as everyone expects. Special escapes interpretation is activated by giving option -e, --escapes to enscript.
All special escapes start with the escape character. The default escape character is ^@ (octal 000); escape character can be changed with option -e, --escapes. Escape character is followed by escape's name and optional options and arguments.
Currently enscript supports following escapes:
^@bgcolor{red green blue}
where the color components red, green, and blue are given as decimal numbers between values 0 and 1.
^@bggray{gray}
where gray is the new text background gray value. The default value is 1.0 (white).
^@color{red green blue}
where color components red, green and blue are given as decimal numbers between values 0 and 1.
^@comment text newline_character
^@escape{code}
where code is the decimal code of the new escape character.
^@epsf[options]{filename}
where options is an optional sequence of option characters and values enclosed with brackets and filename is the name of the EPS file.
If filename ends to the `|' character, then filename is assumed to name a command that prints EPS data to its standard output. In this case, enscript opens a pipe to the specified command and reads EPS data from pipe.
Following options can be given for the epsf escape:
^@font{fontname[:encoding]}
where fontname is a standard font specification. Special font specification default can be used to select the default body font (enscript's default or the one specified by the command line option -f, --font).
The optional argument encoding specifies the encoding that should be used for the new font. Currently the encoding can only be the enscript's global input encoding or ps.
^@ps{code}
^@shade{gray}
where gray is the new text background gray value. The default value is 1.0 (white) which disables highlighting.
PAGE DEVICE OPTIONS | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
Page device is a PostScript level 2 feature that offers an uniform interface to control printer's output device. Enscript protects all page device options inside an if block so they have no effect in level 1 interpreters. Although all level 2 interpreters support page device, they do not have to support all page device options. For example some printers can print in duplex mode and some can not. Refer to the documentation of your printer for supported options.
Here are some usable page device options which can be selected with the -D, --setpagedevice option. For a complete listing, see PostScript Language Reference Manual: section 4.11 Device Setup.
PRINTING EXAMPLES | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
Following printing examples assume that enscript uses the default configuration. If default actions have been changed from the configuration files, some examples will behave differently.
ENVIRONMENT VARIABLES | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
The environment variable ENSCRIPT can be used to pass default options for enscript. For example, to select the default body font to be Times-Roman 7pt, set the following value to the ENSCRIPT environment variable:
The value of the ENSCRIPT variable is processed before the command line options, so command line options can be used to overwrite these defaults.
Variable ENSCRIPT_LIBRARY specifies the enscript's library directory. It can be used to overwrite the build-in default `/usr/share/enscript'.
RETURN VALUE | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
Enscript returns value 1 to the shell if any errors were encountered or 0 otherwise. If the option --extended-return-values was specified, the return value is constructed from the following flags:
FILES | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
/usr/share/enscript/*.hdr header files /usr/share/enscript/*.enc input encoding vectors /usr/share/enscript/enscript.pro PostScript prolog /usr/share/enscript/afm/*.afm AFM files for PostScript fonts /usr/share/enscript/font.map index for the AFM files /usr/share/enscript/hl/*.st states definition files /etc/enscript.cfg system-wide configuration file /etc/enscriptsite.cfg site configuration file ~/.enscriptrc personal configuration file ~/.enscript/ personal resource directory
SEE ALSO | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
AUTHOR | Début | Précédent | Suivant | Sommaire | Préc.page.lue | Accueil |
GNU Enscript WWW home page: <http://www.iki.fi/~mtr/genscript/>
Sommaire | Début | Suivant | Sommaire | Préc.page.lue | Accueil |
Table des mots clés | Début | Suivant | Sommaire | Préc.page.lue | Accueil |