ASCII Text Files


EasyCopy includes a filter that implements support for ASCII text files by means of the of the Text to PS Converter.

The filter is established by the following line in the filter definition file:

Windows
"*xzASCII "\"$ECTOPDIR\\text2ps.exe\"" "ASCII.\r\n"
 
UNIX
*xzASCII "$ECBINDIR/text2ps.bin" "ASCII.\n"

This filter converts the file to PostScript which in turn is taken through the Ghostscript filter.

The text2ps program does the conversion to PostScript. It is automatically installed together with EasyCopy. Refer to the description of the Text to PS Converter for a more detailed description of the conversion program.

You can also configure the filter to call another converter than the one delivered with EasyCopy. A popular ASCII converter is the free a2ps available from www.inf.enst.fr/~demaille/a2ps/.

ASCII to PostScript Conversion

EasyCopy can convert ASCII text files to PostScript and print the resulting file on a PostScript printer or pass it to a PostScript filter.

The conversion is done by means of the program text2.ps. This program is installed together with EasyCopy and is by default configured as an import filter in the filters configuration file.

A file is recognized as an ASCII text file if:

  1. At least 80% of the first 1024 characters in the file must be white space characters (0x09, 0x0A, 0x0C, 0x0D, 0x20) or "normal" ASCII characters (0x20 < c < 0x80).
  2. The file has not been recognized as another file type (PostScript files and some ASCII based image or graphics formats might otherwise pass the test).
The calling syntax for the converter is:

Windows
text2ps.exe [options] [input]
 
UNIX
text2ps.bin [options] [input]

Input File
If no input file is specified the filter reads from stdin.
 
Options
-aaspect-ratio
You can specify a narrow or wide font by means of the aspect ratio. It is used as a horizontal scale factor. The default is 1.
Specify -a0.75 to make a narrow text (75% of normal character width).
 
-eencoding
You can specify the encoding vector for the character set. The default is IsoLatin1Encoding. The encoding vector must be know by Ghostscript (or the PostScript printer if you use text2ps to send ASCII files to a printer).
 
-ffont
You can specify the font to be used. The default is Courier. The font must be known by Ghostscript (or the PostScript printer).
Specify -fHelvetica -s12 to print in 12 point Helvetica.
 
-h
Specify this option to display help information on the command line syntax of the converter.
 
-llinelength
The maximum line length. The default is 256 characters.
 
-mmargin
You can specify a margin. It applies to the left, top, and bottom. To the right is printed as much as allowed by the printable area of the printer. The margin must be specified in millimeters. The default is 25.4 mm (1 inch).
 
-n
The noheader option disables a header on each page. By default headers are enabled.
File: hello_world.c       Tue May 24 13:04:43 2005       smith         Page 1
 
-ofilename
You can specify an output file (the PostScript file). By default the output goes to stdout.
 
-r
Use the rotate option to specify landscape printing.
The page size (-x and -y options) always refer to portrait orientation of the page.
 
-ssize
You can specify a point size of the printed text. The default is 10 points.
 
-xpagewidth, -ypageheight
You can specify the page size. Width and height must be specified in points. The default is 595 by 842 (this corresponds to A4).

Copyright © 2005, AGI (autoGraph international), www.augrin.com.