[comp.lang.postscript] ASCII -> Postscript Filter

drl@corpane.UUCP (Dan Lance) (12/09/89)

I am looking for a public domain program to convert ASCII text to PostScript,
so that I can use a PostScript printer connected to my UNIX box as a line
printer.  (386 clone running System V Unix--ISC 386/ix 2.0.2).  If someone
could point me to where such a beast could be found, I would appreciate it
greatly.

ADthanksVANCE,
--drl
Dan Lance / Corpane Industries, Inc., Louisville, KY / drl@corpane.uucp
-- 
--drl
Dan Lance / Corpane Industries, Louisville KY 
...!uunet!corpane!drl  corpane!drl@ddsw1.mcs.com  corpane!drl@e.ms.uky.edu

SAGER@S35.Prime.COM (12/11/89)

drl@corpane.UUCP writes:

>I am looking for a public domain program to convert ASCII text to PostScript,
>so that I can use a PostScript printer connected to my UNIX box as a line
>printer.  (386 clone running System V Unix--ISC 386/ix 2.0.2).  If someone
>could point me to where such a beast could be found, I would appreciate it
>greatly.

Please also send me this info to if you can. Email me directly to ensure
that I get it.

Leo Sager             | Public Data Network Address:  | I want it all! I want
Prime Computer, Inc.  |                               | it all! I want it all!
Framingham, MA        |     SAGER@S35.Prime.Com       | And I want it NOW!

hall@aplcen.apl.jhu.edu (Marty Hall) (12/13/89)

drl@corpane.UUCP writes:

>I am looking for a public domain program to convert ASCII text to PostScript,
>so that I can use a PostScript printer connected to my UNIX box as a line
>printer.  (386 clone running System V Unix--ISC 386/ix 2.0.2).  If someone
>could point me to where such a beast could be found, I would appreciate it
>greatly.

Barry Brachman [brachman@grads.cs.ubc.cdn] posted such a thing to the net
earlier this year. He called it "lwf" for "Laser Writer Filter". It was in
comp.sources.xxx [unix or misc], and should be available in the uunet
archives. It works fine on my Sun, translating ASCII text into Courier
for my PS Printer.
				- Marty Hall
------------------------------------------------------
hall@aplcen.apl.jhu.edu, apl_aimh@jhunix.bitnet, ..uunet!aplcen!hall
Artificial Intelligence Lab, AAI Corp, PO Box 126, Hunt Valley, MD 21030

brachman@cs.ubc.ca (Barry Brachman) (12/14/89)

In article <4315@aplcen.apl.jhu.edu> hall@aplcen.apl.jhu.edu (Marty Hall) writes:
<drl@corpane.UUCP writes:
<
<<I am looking for a public domain program to convert ASCII text to PostScript,
<<so that I can use a PostScript printer connected to my UNIX box as a line
<<printer.  (386 clone running System V Unix--ISC 386/ix 2.0.2).  If someone
<<could point me to where such a beast could be found, I would appreciate it
<<greatly.
<
<Barry Brachman [brachman@grads.cs.ubc.cdn] posted such a thing to the net
<earlier this year. He called it "lwf" for "Laser Writer Filter". It was in
<comp.sources.xxx [unix or misc], and should be available in the uunet
<archives. It works fine on my Sun, translating ASCII text into Courier
<for my PS Printer.
<				- Marty Hall
<------------------------------------------------------
<hall@aplcen.apl.jhu.edu, apl_aimh@jhunix.bitnet, ..uunet!aplcen!hall
<Artificial Intelligence Lab, AAI Corp, PO Box 126, Hunt Valley, MD 21030

An updated version of the ASCII to PostScript filter can be ftp'ed from
cs.ubc.ca (128.189.97.5).  It's in tmp/lwf-2.1.shar.Z.

-----
Barry Brachman           | UUCP:    {alberta,uw-beaver,uunet}!
Dept. of Computer Science|           ubc-vision!ubc-csgrads!brachman
Univ. of British Columbia| Internet: brachman@cs.ubc.ca
Vancouver, B.C. V6T 1W5  |           brachman%ubc.csnet@csnet-relay.arpa
(604) 228-3123           | brachman@ubc.csnet

lai@batcave.UUCP (Henry Lai) (12/14/89)

If you're not looking for anything too fancy, you can use the routines
given in the "green" book. Here is a simple one (if I remember it
correctly) that justs prints the text as is, without any modifications,
kerning, etc.

%!
/s 256 string def
/printloop {
	{currentfile cvlit s readline not 
	{exit}if
	show currentpoint exch pop 12 sub dup 36 le 
	{pop copypage erasepage 0 720 moveto} {0 exch moveto}ifelse
	}loop 
	showpage
}bind def

/Courier findfont 12 scalefont setfont
0 720 moveto printloop % this should be followed by the ASCII text

You should send this to your printer and then send your text file. A ctrl-D
signals end of job to the printer.

(If I remember, the example in the "green" book uses =string instead of
the string I declared. =string is only holds 128 characters.)
-- 
Henry Lai      lai%batcave@larry.mcrcim.mcgill.edu
{mit-eddie,ucbvax,uunet}!mcgill-vision!batcave!lai

howard@hasse.ericsson.se (Howard Gayle) (12/15/89)

In article <1252@corpane.UUCP>, drl@corpane (Dan Lance) writes:
>I am looking for a public domain program to convert ASCII text to PostScript,
Allow me to hype cz a little, though it is free software, not
public domain.


      DESCRIPTION

The cz system converts text files in any "context-free
octet-based" character set into PostScript.  By octet-based, I
mean that each character in the character set is represented by
a sequence of one or more 8-bit bytes.  By "context-free" I mean
that only the octets of a character determine what the character
is, not any other octets in the file.  This excludes character
sets that use locking shift sequences, for example (complete)
ISO 2022.

Currently, cz can handle the ISO 8859/1 character set, also
known as Latin-1.  This is a superset of ASCII, with characters
for all major Western European languages.  cz can also handle
several national versions of ISO 646, including ASCII and
"SWASCII," the Swedish national versions.  SWASCII is the
character set that uses vertical bar (|) for o with umlaut,
etc.  cz can also handle most of CCITT T.61, the teletext
character set also used for X.400 mail.  T.61 is (almost) a
subset of ISO 6937/2.

cz is completely table-driven, and it is easy to get cz to emit
the PostScript for other character sets.  The hard part is
figuring out what PostScript cz should emit.

An optional heuristic attempts to guess when certain ISO 646 bit
codes represent ASCII (e.g. right curly brace) and when they
represent SWASCII (e.g. a with ring.)  The measured error rate
of this heuristic is less than 3% on real swnet (Swedish news
group hierarchy) news articles.  There is also a heuristic for
Danish, and tools and documentation for writing heuristics for
other languages.  These heuristics can be used for other
purposes than printing text files, e.g. in mail and news
readers.

cz is very flexible.  It can use any font available on the
output device.  You have complete control over font sizes, paper
size, page layout, number of columns, line numbers, portrait or
landscape mode, page reversal, leading (line spacing), tab
expansion, and x- or y-axis adjustments to handle misaligned
printers.  cz handles the same typographic units as TeX, e.g.
millimeters, inches, points, etc.

For GNU Emacs users, there are functions cz-buffer and cz-region
analogous to lpr-buffer and lpr-region.  These print ISO 8859/1
by default, but the character set can be changed by changing the
elisp variable cz-CommandFile.  The elisp variables
cz-FixedWidth and cz-AutoLandscape can be set to control the
body font and format, and the variable cz-output can be modified
to output to a different printer.

If you read mail with the RMAIL mode of GNU Emacs, you can print
a copy of any message with the function rmail-cz.  This is by
default bound to the "L" (Laser) key.

If you read mail with Sun's mailtool, you can set the printmail
variable in your .mailrc file to the command cz-news.  This will
print the current message when you click the print button.

If you read news with the Gnews mode of GNU Emacs, you can print
a copy of any article with the function Gnews-cz.  This is by
default bound to the "L" (Laser) key.

If you read news with rn or rrn, you can define macros in your
.rnmac file to call the command cz-news.

The cz system has three mechanisms for handling long lines.
AutoColumn can be used to reduce the number of page columns if a
line exceeds a certain length.  For example, you can specify
two-column mode by default, but switch automatically to
single-column mode in case a long line is encountered.

AutoLandscape can be used to switch automatically from portrait
mode to landscape mode if a long line is encountered.

Both AutoColumn and AutoLandscape can operate on either a
page-by-page or a whole file basis.  For example, AutoLandscape
in the page-by-page mode prints pages containing long lines in
landscape mode, and other pages in portrait mode.

Long lines can also be folded, i.e. broken across several output
lines.  The line breaks are marked by a special symbol, and the
continuation lines are indented.

Paper margins can be specified separately for landscape and
portrait mode.  For example, it is easy to have a 10 mm top
margin in portrait mode and a 20 mm top margin in landscape
mode.

An option places a control-D at the end of the PostScript
output, for printers that need one.

Landscape rotation can be either positive or negative, i.e.
with paper with holes, you can have the holes at the top or the
bottom of the page.

The line number of the last line in a file is always printed, if
line number printing is enabled.  This makes it easy to see how
many lines are in a file.  Turning off line number printing does
not change the left margin.


      WHAT TO GET FROM THE ARCHIVE

cz        comp.sources.misc volume 8 issues 65-75, 77-78 ( 1 Oct 1989)
                                     issue  97           (28 Oct 1989)
libhoward comp.sources.misc volume 8 issues 80-87        ( 1 Oct 1989)
                                     issue  96           (28 Oct 1989)
--
Howard Gayle
TN/ETX/TT/HL
Ericsson Telecom AB
S-126 25 Stockholm
Sweden
howard@ericsson.se
uunet!ericsson.se!howard
Phone: +46 8 719 5565
FAX  : +46 8 719 8439

jgreely@giza.cis.ohio-state.edu (J Greely) (12/17/89)

In article <1989Dec14.163841.16431@ericsson.se> howard@hasse.ericsson.se
 (Howard Gayle) writes:
[lengthy blurb deleted]

Note that you also get, at no extra charge, a complete software
installation philosophy!  Wear it to parties!  Amuse your friends!
Frighten children! (not that it's a *bad* system, necessarily, but
it's rather surprising to find such an amazing amount of extraneous
stuff in a source posting)

>      WHAT TO GET FROM THE ARCHIVE
>cz        comp.sources.misc volume 8 issues 65-75, 77-78 ( 1 Oct 1989)
>                                     issue  97           (28 Oct 1989)
>libhoward comp.sources.misc volume 8 issues 80-87        ( 1 Oct 1989)
>                                     issue  96           (28 Oct 1989)

Also, you need:
	GNU Make, version 3.54 or higher,
	sets, from comp.sources.unix, vol 13, #68,
	LaTeX (if you want to understand the installation system),
	and, possibly, config2, from comp.sources.misc. vol 6, #96

Note that the supplied README file suggests that you *might* need GNU
Make.  Nonsense.  You can't get anywhere without it, so don't even
try.

  For people who are GNU-shy, the whole package is covered by the GNU
Public License.

  Pretty hefty baggage for a text-to-PS converter, no?  I might
compile it to look at it, but I think I'll spare our users for a
while.  Enscript may lack the "gee-whiz" features, but it's simple to
use (modulo the undocumented escape sequences), small, and produces
decent PostScript.
--
J Greely (jgreely@cis.ohio-state.edu; osu-cis!jgreely)

roy@phri.nyu.edu (Roy Smith) (12/17/89)

J Greely <jgreely@cis.ohio-state.edu> writes:
> Enscript may lack the "gee-whiz" features, but it's simple to use (modulo
> the undocumented escape sequences), small, and produces decent PostScript.

	What undocumented escape sequences?  You mean, after all these
years, I can stop telling people that there is no way to get sub and
superscripts using enscript?  It looks like I've forgotten the standard
Unix wizzard motto; if you want to know how something works, RTFSC!  Doing
so now, I see that it looks like the standard nroff output escapes (ESC-8,
ESC-9, etc) are understood.  Why isn't this in the man page!?
--
Roy Smith, Public Health Research Institute
455 First Avenue, New York, NY 10016
roy@alanine.phri.nyu.edu -OR- {att,philabs,cmcl2,rutgers,hombre}!phri!roy
"My karma ran over my dogma"

howard@hasse.ericsson.se (Howard Gayle) (12/18/89)

(I'm moving this thread to comp.sources.d.)

In article <JGREELY.89Dec16152751@giza.cis.ohio-state.edu>, jgreely@giza (J Greely) writes:
>Note that you also get, at no extra charge, a complete software
>installation philosophy!  Wear it to parties!  Amuse your friends!
>Frighten children! (not that it's a *bad* system, necessarily, but
>it's rather surprising to find such an amazing amount of extraneous
>stuff in a source posting)

Every source posting with a makefile comes with some implicit
assumptions about the target environment.  Almost always, the
assumptions are that there is one target, and it's the one the
source is on.  But today, many UNIX machines are in networks of
machines with different architectures and different operating
systems.  We at Ericsson have some tools to help manage software
in such an environment.  The tools are flexible, so installation
on a single, stand-alone machine is just a special case.  The
README gives an example.  These tools may frighten children, but
I'm confident that adults can handle them.
--
Howard Gayle
TN/ETX/TT/HL
Ericsson Telecom AB
S-126 25 Stockholm
Sweden
howard@ericsson.se
uunet!ericsson.se!howard
Phone: +46 8 719 5565
FAX  : +46 8 719 8439

jbw@unix.cis.pitt.edu (Jingbai Wang) (12/19/89)

In article <JGREELY.89Dec16152751@giza.cis.ohio-state.edu> J Greely <jgreely@cis.ohio-state.edu> writes:
>In article <1989Dec14.163841.16431@ericsson.se> howard@hasse.ericsson.se
> (Howard Gayle) writes:
>[lengthy blurb deleted]
>
>Note that you also get, at no extra charge, a complete software
>installation philosophy!  Wear it to parties!  Amuse your friends!
>...
>...
>  Pretty hefty baggage for a text-to-PS converter, no?  I might

I have seen ASCII->PS query too much lately. Why don't we say this:
there are a number of ASCII->PS converters, and a2ps from science.utah.edu
seems to having  used on many machines.

If the interested respond quick enough (since my accounts going out), I  may
even offer you a package which can do much more then you desire. It is
can be used as ASCII->PS with default font being 12pt Courier of 6.5in
linewidth. Lines longer than that are wrapped around. However, you can
also use it as a formatter using any of the Adobe fonts (specified in 
TFM files). It was originally  designed for Chinese text.

JB Wang