ENSCRIPT(1)
๐ ENSCRIPT(1) โ the enscript manual, bestie edition ๐
Okay so welcome to the ENSCRIPT(1) manual page, bestie. The command is enscript, and she's iconic. We're gonna go through every single detail together, fr fr. ๐ซถ
๐ธ NAME ๐ธ
enscript โ convert text files to PostScript, HTML, RTF, ANSI, and overstrikes.
โจ SYNOPSIS โจ
enscript [-123456789BcgGhjkKlmOqrRvVzZ] [-# copies] [-a pages] [-A
align] [-b header] [-C[start_line]] [-d printer] [-D key[:value]]
[-e[char]] [-E[lang]] [-f font] [-F header_font] [-H[num]] [-i indent]
[-I filter] [-J title] [-L lines_per_page] [-M media] [-n copies] [-N
newline] [-o outputfile] [-o -] [-p outputfile] [-p -] [-P printer] [-s
baselineskip] [-S key[:value]] [-t title] [-T tabsize] [-u[text]] [-U
num] [-w language] [-X encoding] [filename ...]
๐ฆ DESCRIPTION ๐ฆ
Enscript converts text files to PostScript or to other output languages. It 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.
It's giving main character energy: text files in, fancy printouts out. Periodt. ๐
๐ OPTIONS ๐
-# numโ Printnumcopies of each page. ๐-1,-2,-3,-4,-5,-6,-7,-8,-9,--columns=numโ Specify how many columns each page has. With the long option--columns=numyou can specify more than9columns per page. Slay. โจ-a pages,--pages=pagesโ Specify which pages are printed. The page specificationpagescan be given in the following formats:begin-endโ print pages frombegintoend-endโ print pages from0toendbegin-โ print pages frombegintoendpageโ print pagepageoddโ print odd pagesevenโ print even pages
-A align,--file-align=alignโ Align separate input files to even align page count. This option is useful in two-side and 2-up printings (--file-align=2). ๐-b header,--header=headerโ Use the textheaderas a page header. The default page header is constructed from the name of the file and from its last modification time.
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 date 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. ๐
-B,--no-headerโ Do not print page headers. ๐-c,--truncate-linesโ Cut lines that are too long for the page. As a default, enscript wraps long lines to the next line so no information is lost.
You can also use the --slice option which slices long lines to separate pages. โ๏ธ
-C[start_line],--line-numbers[=start_line]โ Precede each line with its line number. The optional argumentstart_linespecifies the number of the first line in the input. The number of the first line defaults to1. ๐ข-d nameโ Spool output to the printername. ๐จ๏ธ-D key[:value],--setpagedevice=key[:value]โ Pass a page device definition to the generated PostScript output. If no value is given, the keykeyis removed from the definitions.
For example, the command enscript -DDuplex:true foo.txt prints file foo.txt in duplex (two side) mode.
Page device operators are implementation dependent but they are standardized. See section PAGE DEVICE OPTIONS for the details. ๐ฅ
-e[char],--escapes[=char]โ Enable special escapes interpretation (see section SPECIAL ESCAPES). If the argumentcharis given, it changes the escape character tochar. The default escape character is0. โจ-E[lang],--highlight[=lang]โ Highlight source code by creating a special input filter with thestatesprogram. The optional argumentlangspecifies the language to highlight. As a default thestatesmakes an educated guess.
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/hl/*.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. ๐
-f name,--font=nameโ Select a font that is used for the body text. The default body font isCourier10, unless multicolumn landscape printing mode is selected, in which case the default font isCourier7.
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. ๐
-F name,--header-font=nameโ Select a font for the header texts. ๐-g,--print-anywayโ Print a file even if it contains binary data. The option is implemented only for compatibility purposes. Enscript prints binary files anyway regardless of the option. ๐ซถ-G,--fancy-header[=name]โ Print a fancy page headernameto the top of each page. The option-Gspecifies the default fancy header. See section CONFIGURATION FILES to see how the default fancy header can be changed. ๐-h,--no-job-headerโ Suppress printing of the job header page. ๐-H[num],--highlight-bars[=num]โ Specify how high the highlight bars are in lines. If thenumis not given, the default value2is used. As a default, no highlight bars are printed. โญ-i num,--indent=numโ Indent every linenumcharacters. The indentation can also be specified in other units by appending an unit specifier after the number. The possible unit specifiers and the corresponding units are:cโ centimetersiโ incheslโ characters (default)pโ PostScript points
-I filter,--filter=filterโ Read all input files through an input filterfilter. The input filter can be a single command or a command pipeline. The filter can refer to the name of the input file with the escape%s. The name of the standard input can be changed with the option--filter-stdin.
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". ๐ฅ
-j,--bordersโ Print borders around columns. ๐ผ๏ธ-J titleโ An alias for the option-t,--title. ๐-k,--page-prefeedโ Enable page prefeed. ๐-K,--no-page-prefeedโ Disable page prefeed (default). ๐-l,--lineprinterโ Emulate lineprinter. This option is a shortcut for the options--lines-per-page=66, and--no-header. ๐จ๏ธ-L num,--lines-per-page=numโ Print onlynumlines for each page. As a default, the number of lines per page is computed from the height of the page and from the size of the font. ๐-m,--mailโ Send a mail notification to user after the print job has been completed. ๐ฌ-M name,--media=nameโ Select an output medianame. Enscript's default output media isLC_PAPER. ๐จ-n num,--copies=numโ Printnumcopies of each page. ๐-N nl,--newline=nlโ Select the newline character. The possible values fornlare:n(unix newline,0xahex) andr(mac newline,0xdhex). ๐ฑ-o fileโ An alias for the option-p,--output. ๐ซ-O,--missing-charactersโ Print a listing of character codes which couldn't be printed. ๐ญ-p file,--output=fileโ Leave the output to filefile. If the file is-, enscript sends the output to the standard outputstdout. ๐-P name,--printer=nameโ Spool the output to the printername. ๐จ๏ธ-q,--quiet,--silentโ Make enscript really quiet. Only fatal error messages are printed tostderr. ๐คซ-r,--landscapeโ Print in the landscape mode; rotate page90degrees. ๐-R,--portraitโ Print in the portrait mode (default). ๐-s num,--baselineskip=numโ Specify the baseline skip in PostScript points. The numbernumcan be given as a decimal number. When enscript moves from line to line, the current point y coordinate is moved (font point size +baselineskip) points down. The default baseline skip is1. ๐-S key[:value],--statusdict=key[:value]โ Pass a statusdict definition to the generated PostScript output. If no value is given, the keykeyis removed from the definitions.
The statusdict operators are implementation dependent; 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). ๐จ๏ธ
-t title,--title=titleโ Set banner page's job title totitle. The option sets also the name of the input filestdin. ๐ท๏ธ-T num,--tabsize=numโ Set the tabulator size tonumcharacters. The default is8. ๐-u[text],--underlay[=text]โ bestie, this prints the string text under every single page ๐ you can glow it up with--ul-angle,--ul-font,--ul-gray,--ul-position, and--ul-style.
if you don't give any text at all, the underlay justโฆ doesn't print. which is lowkey the whole point sometimes โ it's how you remove an underlay that got set via the Underlay configuration file option. ghosting your own underlay, iconic ๐ซถ
-U num,--nup=numโ prints num logical pages on each output page (this is the N-up printing vibe โจ). and no, num can't just be anything โ it must be a power of 2. math said so.-v,--verbose[=level]โ tells you what enscript is out here doing. narration on. ๐ฌ-V,--versionโ prints enscript version info and dips. bye ๐-w [lang],--language[=lang]โ generates output for the language lang. the possible values for lang are, and I quote:PostScriptโ generate PostScript (default)htmlโ generate HTMLoverstrikeโ generate overstrikes (line printers,less)rtfโ generate RTF (Rich Text Format)ansiโ generate ANSI terminal control codes
-W app,option,--language=app,optionโ passes the option option to helper application app. teamwork, fr fr ๐ค-X name,--encoding=nameโ uses the input encoding name. currently enscript supports these encodings, buckle up ๐:88591,latin1โ ISO-8859-1 (ISO Latin1) (enscript's default encoding).88592,latin2โ ISO-8859-2 (ISO Latin2)88593,latin3โ ISO-8859-3 (ISO Latin3)88594,latin4โ ISO-8859-4 (ISO Latin4)88595,cyrillicโ ISO-8859-5 (ISO Cyrillic)88597,greekโ ISO-8859-7 (ISO Greek)88599,latin5โ ISO-8859-9 (ISO Latin5)885910,latin6โ ISO-8859-10 (ISO Latin6)885913,latin7โ ISO-8859-13 (ISO Latin7)885915,latin9โ ISO-8859-15 (ISO Latin9)asciiโ 7-bit asciiasciifise,asciifi,asciiseโ 7-bit ascii with some scandinavian (Finland, Sweden) extensionsasciidkno,asciidk,asciinoโ 7-bit ascii with some scandinavian (Denmark, Norway) extensionsibmpc,pc,dosโ IBM PC charsetmacโ Mac charsetvmsโ VMS multinational charsethp8โ HP Roman-8 charsetkoi8โ Adobe Standard Cyrillic Font KOI8 charsetps,PSโ PostScript font's default encodingpslatin1,ISOLatin1Encodingโ PostScript interpreter'sISOLatin1Encoding
-z,--no-formfeedโ turns off the form feed character interpretation. no more page-break surprises ๐-Z,--pass-throughโ passes through all PostScript and PCL files without any modifications. this is the one that lets enscript be used as alpfilter ๐ฅ
PostScript files get recognized by looking up the %! magic cookie from the beginning of the file. note! enscript also recognizes the Windoze damaged ^D%! cookie ๐
PCL files get recognized by looking up the ^[E or ^[% magic cookies from the beginning of the file.
--color[=bool]โ uses colors in the highlighting outputs ๐ yes queen, color.--download-font=fontnameโ includes the font description file (.pfaor.pfbfile) of the font fontname in the generated output.--extended-return-valuesโ enables extended return values. as a default, enscript returns1on error and0otherwise. the extended return values give you way more deets about the printing operation โ see the section RETURN VALUE for the details ๐--filter-stdin=nameโ specifies how the stdin is shown to the input filter. default value is an empty string ("") but some programs require that the stdin is called something else, usually-.--footer=footerโ uses the text footer as a page footer. otherwise the option works like the--headeroption ๐ฆ--h-column-height=heightโ sets the horizontal column height to height PostScript points. this option also sets the formfeed type tohorizontal-columns.--helpโ prints a short help message and exits. classic.--help-highlightโ describes all supported--highlightlanguages and file formats. a whole lil encyclopedia โจ--highlight-bar-gray=grayโ specifies the gray level used when printing the highlight bars.--list-mediaโ lists the names of all known output media and exits successfully. window shopping for paper ๐--margins=left:right:top:bottomโ adjusts the page marginals to be exactly left, right, top and bottom PostScript points. any of the arguments can be left empty, in which case the default value is used.--mark-wrapped-lines[=style]โ marks wrapped lines in the output with the style style. the possible values for style are:noneโ do not mark them (default)plusโ print a plus (+) character to the end of each wrapped lineboxโ print a black box to the end of each wrapped linearrowโ print a small arrow to the end of each wrapped line
--non-printable-format=formatโ specifies how the non-printable characters are printed. the possible values for format are:caretโ caret notation:^@,^A,^B, ...octalโ octal notation:\000,\001,\002, ... (default)questionmarkโ replace non-printable characters with a question mark?spaceโ replace non-printable characters with a space
--nup-columnwiseโ changes the layout of the sub-pages in the N-up printing from row-wise to columnwise. rotate the vibes ๐--nup-xpad=numโ sets the page x-padding of the n-up printing to num PostScript points. the default is 10 points.--nup-ypad=numโ sets the page y-padding of the n-up printing to num PostScript points. the default is 10 points.--page-label-format=formatโ sets the page label format to format. the page label format specifies how the labels for the%%Page:PostScript comments are formatted. the possible values are:shortโ print the current pagenumber:%%Page: (1) 1(default)longโ print the current filename and pagenumber:%%Page: (main.c: 1) 1
--ps-level=levelโ sets the PostScript language level that enscript uses for its output to level. the possible values are1, and2.--printer-options=optionsโ passes extra options to the printer command. ๐จ๏ธ--rotate-even-pagesโ rotates each even-numbered page 180 degrees. why? chaos. but cute chaos ๐--slice=numโ prints the vertical slice num. the slices are vertical regions of input files. a new slice starts from the point where the line would otherwise be wrapped to the next line. the slice numbers start from1.--style=styleโ sets the highlighting style to style. the possible values are:a2ps,emacs,emacs_verbose,ifh, andmsvc.--swap-even-page-marginsโ swaps left and right page margins for even-numbered pages.--tocโ prints a table of contents to the end of the output. organized queen ๐--word-wrapโ wraps long lines from word boundaries. no mid-word crimes ๐ซ--ul-angle=angleโ sets the angle of the underlay text to angle. as a default, the angle isatan(-d_page_h, d_page_w).--ul-font=nameโ selects a font for the underlay text. the default underlay font isTimes-Roman200. fancy ๐--ul-gray=numโ prints the underlay text with the gray value num (0 ... 1), the default gray value is.8.--ul-position=position_specโ sets the underlay text's starting position according to the position_spec. the position specification must be given in format:sign xpos sign ypos, where the sign must be+or-. the positive dimensions are measured from the lower left corner and the negative dimensions from the upper right corner. for example, the specification+0-0specifies the upper left corner and-0+0specifies the lower right corner. coordinate girlie math ๐ง--ul-style=styleโ sets the underlay text's style to style. the possible values for style are:outlineโ print outline underlay texts (default)filledโ print filled underlay texts
๐ CONFIGURATION FILES ๐
Okay bestie, so enscript is lowkey a little configuration goblin ๐ง โ it reads its settings from a bunch of places. Hereโs the order it checks them in, and yes, the order matters:
- command line options
- environment variable
ENSCRIPT - userโs personal configuration file (
$HOME/.enscriptrc) - site configuration file (
/etc/enscriptsite.cfg) - systemโs global configuration file (
/etc/enscript.cfg)
The configuration files have this format, no cap:
- 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, and yes, weโre going through every single one like the completionists we are ๐ :
๐ config file options ๐
AcceptCompositeCharacters: boolโ should PostScript font composite characters count as printable, or should they be treated as non-existent? default isfalse(0).AFMPath: pathโ sets the search path for the AFM files.AppendCtrlD: boolโ should the Control-D (^D) character be appended to the end of the output? default isfalse(0).Clean7Bit: boolโ controls how characters greater than 127 get printed.true(1) makes 7-bit clean code by escaping all characters greater than 127 into backslash-octal notation (this is the default).false(0) makes 8-bit PostScript code and leaves all characters untouched.DefaultEncoding: nameโ selects the default input encoding. the encoding namenamecan be one of the values of the option-X,--encoding.DefaultFancyHeader: nameโ selects the default fancy header. this default header is used when the option-Gis specified, or when--fancy-headeris given without an argument. the system-wide default isenscript.DefaultMedia: nameโ selects the default output media.DefaultOutputMethod: methodโ selects the default target that the generated output gets sent to. possible values formethodare:printerโ send output to printer (default)stdoutโ send output to stdout
DownloadFont: fontnameโ include the font description file of the fontfontnamein the generated output.EscapeChar: numโ sets the escape character for the special escapes. default is0.FormFeedType: typeโ sets what happens when a formfeed character shows up in the input. possible values fortypeare:columnโ move to the beginning of the next column (default)pageโ move to the beginning of the next page
GeneratePageSize: boolโ should thePageSizepage device setting be generated into the PostScript output? default istrue(1).HighlightBarGray: grayโ sets the gray level used to print the highlight bars.HighlightBars: numโ sets how high the highlight bars are, in lines. default is0, which means no highlight bars are printed.LibraryPath: pathโ sets enscriptโs library path, which is used to look up various resources. the default path is/usr/share/enscript:home/.enscript. where thehomeis the userโs home directory.MarkWrappedLines: styleโ marks wrapped lines in the output with the stylestyle. the possible values for the format are the same ones you can give for the--mark-wrapped-linesoption.Media: name width height llx lly urx uryโ adds a new output media with the namename. the physical dimensions of the media arewidthandheight. the bounding box of the Media is specified by the points (llx,lly) and (urx,ury). enscript prints all graphics inside the bounding box of the media.
user can select this media with the option -M name.
NoJobHeaderSwitch: switchโ sets the spooler option that suppresses the print job header page. this option gets passed to the printer spooler when enscriptโs option-h,--no-job-headeris selected.NonPrintableFormat: formatโ sets how non-printable characters are printed. possible values forformatare the same ones you can give for the--non-printable-formatoption.OutputFirstLine: lineโ sets the PostScript outputโs first line toline. the default value isPS-Adobe-3.0. since some printers do not like DSC levels greater than 2.0, this option can be used to change the output first line to something more suitable like%!PS-Adobe-2.0or%!.PageLabelFormat: formatโ sets the page label format toformat. possible values forformatare the same ones you can give for the--page-label-formatoption.PagePrefeed: boolโ enables / disables page prefeed. default isfalse(0).PostScriptLevel: levelโ sets the PostScript language level that enscript uses for its output tolevel. possible values forlevelare the same ones you can give for the--ps-leveloption.Printer: nameโ names the printer to which the output is spooled.QueueParam: nameโ the spooler command switch used to select the printer queue, e.g.-Pinlpr -Pps. this option can also be used to pass other flags to the spooler command. these options must be given before the queue switch.SetPageDevice: key[:value]โ passes a page device definition to the generated PostScript output.Spooler: nameโ names the printer spooler command. enscript pipes generated PostScript to the commandname.StatesBinary: pathโ defines an absolute path to the states program.StatesColor: boolโ should the states program generate color outputs?StatesConfigFile: fileโ reads highlighting states configuration from the filefile. the default config file is/usr/share/enscript/hl/enscript.st.StatesHighlightStyle: styleโ sets the highlight style tostyle.StatesPath: pathโ defines the path for the states program. the states program will look up its state definition files from this path. the default value is$HOME/.enscript:/usr/share/enscript/hl.StatusDict: key[:value]โ passes a statusdict definition to the generated PostScript output.TOCFormat: formatโ formats table of contents entries with the format stringformat. the format stringformatcan contain the same escapes that are used to format header strings with the%Formatspecial comment.Underlay: textโ prints the stringtextunder every page.UnderlayAngle: numโ sets the angle of the underlay text tonum.UnderlayFont: fontspecโ selects a font for the underlay text.UnderlayGray: numโ prints the underlay text with the gray valuenum.UnderlayPosition: position_specโ sets the underlay textโs starting position according to theposition_spec.UnderlayStyle: styleโ sets the underlay textโs style tostyle.
๐ธ FANCY HEADERS ๐ธ
Okay bestie, this is the DIY header era ๐
. Users can make their own fancy headers by making a header description file and dropping it into a directory thatโs in enscriptโs library path. The header file name has to be in this format: headername.hdr. Then you pick it with --fancy-header=headername, and boom, custom header unlocked โจ.
The header description file has PostScript code that actually paints the header. It must provide a procedure called do_header, because enscript calls that at the beginning of every page. Main character procedure energy, fr fr ๐.
A header description file has two parts: comments and code. Theyโre separated by a line containing this text:
% -- code follows this line --
Enscript copies only the code part of the description file into the generated PostScript output. The comments part can contain any data โ it is not copied. If the separator line is missing, no data is copied to output. So donโt forget the separator, bestie ๐ญ.
Enscript defines these constants, and you can use them in header description files:
d_page_wโ page widthd_page_hโ page heightd_header_xโ header lower left x coordinated_header_yโ header lower left y coordinated_header_wโ header widthd_header_hโ header heightd_footer_xโ footer lower left x coordinated_footer_yโ footer lower left y coordinated_footer_wโ footer widthd_footer_hโ footer heightd_output_wโ width of the text output aread_output_hโ height of the text output areauser_header_pโ predicate which tells if user has defined his/her own header string: true/falseuser_header_left_strโ ifuser_header_pis true, this is the left field of the user supplied header string.user_header_center_strโ ifuser_header_pis true, this is the center field of the user supplied header stringuser_header_right_strโ ifuser_header_pis true, this is the right field of the user supplied header stringuser_footer_pโ predicate which tells if user has defined his/her own footer string: true/falseuser_footer_left_strโ ifuser_footer_pis true, this is the left field of the user supplied footer string.user_footer_center_strโ ifuser_footer_pis true, this is the center field of the user supplied footer stringuser_footer_right_strโ ifuser_footer_pis true, this is the right field of the user supplied footer stringHFโ standard header font (from-F,--header-fontoption). This can be selected simply by invoking command:HF setfont.pagenumโ the number of the current pagefnameโ the full name of the printed file (/foo/bar.c)fdirโ the directory part of the file name (/foo)ftailโ file name without the directory part (bar.c)gs_languagelevelโ PostScript interpreter's language level (currently1or2)
๐ช special comments, yes bestie
You can also use these special comments to customize your headers and 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:
%Format: name formatโ Define a new string constantnameaccording to the format stringformat. Format string start from the first non-space character and it ends to the end of the line. Format string can contain general%escapes and input file related$escapes. Currently following escapes are supported:%%โ character%$$โ character$$%โ current page number$=โ number of pages in the current file$pโ number of pages processed so far$(VAR)โ value of the environment variableVAR.%cโ trailing component of the current working directory%C($C) โ current time (file modification time) inhh:mm:ssformat%dโ current working directory%D($D) โ current date (file modification date) inyy-mm-ddformat%D{string}($D{string}) โ format stringstringwith thestrftime(3)function.%D{}refers to the current date and$D{}to the input file's last modification date.%E($E) โ current date (file modification date) inyy/mm/ddformat%F($F) โ current date (file modification date) indd.mm.yyyyformat%Hโ document title$Lโ number of lines in the current input file. This is valid only for the toc entries, it can't be used in header strings.%mโ the hostname up to the first.character%Mโ the full hostname%nโ the user login name$nโ input file name without the directory part%Nโ the user'spw_gecosfield up to the first,character$Nโ the full input file name%t($t) โ current time (file modification time) in 12-hour am/pm format%T($T) โ current time (file modification time) in 24-hour formathh:mm%*($*) โ current time (file modification time) in 24-hour format with secondshh:mm:ss$vโ the sequence number of the current input file$Vโ the sequence number of the current input file in theTable of Contentsformat: if the--tocoption is given, escape expands tonum-; if the--tocis not given, escape expands to an empty string.%W($W) โ current date (file modification date) inmm/dd/yyformat
All format directives except $= can also be given in format 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
%HeaderHeight: heightโ Allocateheightpoints space for the page header. The default header height is36points.%FooterHeight: heightโ Allocateheightpoints space for the page footer. The default footer height is0points.
๐ฆ DSC resources, donโt skip this part
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 โจ
Okay so this is the fun part bestie ๐
โ enscript can read special escape sequences that let you sneak actual page-formatting commands into plain ASCII documents. Iconic, right?
By default, special escapes interpretation is off, so all ASCII files print out exactly as everyone expects (no surprise chaos ๐). You turn it on by giving option -e, --escapes to enscript.
Every special escape starts with the escape character. The default escape character is ^@ (octal 000); you can change the escape character with option -e, --escapes. After the escape character comes the escape's name, then any optional options and arguments.
Currently enscript supports the following escapes:
bgcolorโ change the text background color. The syntax of the escape is:
^@bgcolor{red green blue}
where the color components red, green, and blue are given as decimal numbers between values 0 and 1.
bggrayโ change the text background color. The syntax of the escape is:
^@bggray{gray}
where gray is the new text background gray value. The default value is 1.0 (white).
colorโ change the text color. The syntax of the escape is:
^@color{red green blue}
where color components red, green and blue are given as decimal numbers between values 0 and 1.
commentโ comment the rest of the line including the newline character. Escape's syntax is:
^@comment text newline_character
escapeโ change the escape character. The syntax of the escape is:
^@escape{code}
where code is the decimal code of the new escape character.
epsfโ inline an EPS file into the document. The syntax of the escape is:
^@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. Cute AND powerful ๐ซถ.
Following options can be given for the epsf escape:
cโ print image centeredrโ print image right justifiednโ do not update current point. Following output is printed to that position where the current point was just before theepsfescapenxโ do not update current point x coordinatenyโ do not update current point y coordinatexnumโ move image's top left x coordinatenumcharacters from current point x coordinate (relative position)xnumaโ set image's top left x coordinate to columnnum(absolute position)ynumโ move image's top left y coordinatenumlines from current line (relative position)ynumaโ set image's top left y coordinate to linenum(absolute position)hnumโ set image's height tonumlinessnumโ scale image with factornumsxnumโ scale image in x direction with factornumsynumโ scale image in y direction with factornum
As a default, all dimensions are given in lines (vertical) and characters (horizontal). You can also specify other units by appending a unit specifier after number. Possible unit specifiers and the corresponding units are:
cโ centimetersiโ incheslโ lines or characters (default)pโ PostScript points
For example to print an image one inch high, you can specify height by following options: h1i (1 inch), h2.54c (2.54 cm), h72p (72 points). Math? Slayed โจ.
fontโ select current font. The syntax of the escape is:
^@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โ include raw PostScript code to the output. The syntax of the escape is:
^@ps{code}
shadeโ highlight regions of text by changing the text background color. Escape's syntax is:
^@shade{gray}
where gray is the new text background gray value. The default value is 1.0 (white) which disables highlighting.
๐จ๏ธ PAGE DEVICE OPTIONS ๐จ๏ธ
Page device is a PostScript level 2 feature that offers a uniform interface to control the printer's output device. enscript protects all page device options inside an if block so they have no effect in level 1 interpreters. Lowkey thoughtful of it ๐.
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 โ iykyk, check your manual bestie.
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.
Collateboolean โ how output is organized when printing multiple copiesDuplexboolean โ duplex (two side) printingManualFeedboolean โ manual feed paper trayOutputFaceUpboolean โ print outputface uporface downTumbleboolean โ how opposite sides are positioned in duplex printing
๐ PRINTING EXAMPLES ๐
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. (Fair warning, no cap โ ๏ธ)
enscript foo.txtโ Print filefoo.txtto the default printer.enscript -Possu foo.txtโ Print filefoo.txtto printerossu.enscript -pfoo.ps foo.txtโ Print filefoo.txt, but leave PostScript output to filefoo.ps.enscript -2 foo.txtโ Print filefoo.txtto two columns.enscript -2r foo.txtโ Print file to two columns and rotate output 90 degrees (landscape).enscript -DDuplex:true foo.txtโ Print file in duplex (two side) mode (printer dependent).enscript -G2rE -U2 foo.cโ My default code printing command: gaudy header, two columns, landscape, code highlighting, 2-up printing. Literally the main character combo ๐.enscript -E --color -whtml --toc -pfoo.html *.h *.cโ A nice HTML report of your project's C source files. Obsessed with this one fr fr ๐.
๐ธ ENVIRONMENT VARIABLES ๐ธ
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:
-fTimes-Roman7
The value of the ENSCRIPT variable is processed before the command line options, so command line options can be used to overwrite these defaults. Order matters bestie ๐
.
Variable ENSCRIPT_LIBRARY specifies the enscript's library directory. It can be used to overwrite the build-in default /usr/share/enscript. Slay, customizable paths โจ.
๐ฆ RETURN VALUE ๐ฆ
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:
0โ no errors or warnings2โ some lines were truncated or wrapped4โ some characters were missing from the used fonts8โ some characters were unprintable
๐ FILES ๐
/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 ๐
diffpp(1), ghostview(1), gs(1), lpq(1), lpr(1), lprm(1), states(1)
๐ AUTHOR ๐
Markku Rossi <mtr@iki.fi> <http://www.iki.fi/~mtr/>
GNU Enscript WWW home page: <http://www.iki.fi/~mtr/genscript/>
And that's a wrap on the whole page, bestie ๐๐ซถ This edition is ENSCRIPT, dated Mar 12, 1999, and it lives in section ENSCRIPT(1) โ go forth and print something gorgeous, you've got this ๐
โจ๐ท
๐ฆ where this page comes from
- opensuse-leap 16.0: enscript 1.6.6-bp160.1.12 ยท GPL-3.0-or-later
- opensuse-leap 16.0: enscript 1.6.6-bp160.1.12 ยท GPL-3.0-or-later
- opensuse-leap 16.0: enscript 1.6.6-bp160.1.12 ยท GPL-3.0-or-later
- opensuse-leap 16.0: enscript 1.6.6-bp160.1.12 ยท GPL-3.0-or-later
- Copyright (c) 1995-1999 Markku Rossi
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms