[comp.sys.next] quickie envelope printing

dorner@pequod.cso.uiuc.edu (Steve Dorner) (05/05/89)

Here is an awk script I wrote that prints envelopes on the NeXT printer.
You just give it a file that has the return address, a blank line, and
then the from address, and the script wraps the appropriate PostScript
around it and prints it.  It's not exactly earth-shattering, but I find
it useful.

It works for "business size" envelopes.

-- cut here --
#!/bin/awk -f
BEGIN {
  print "%!";
  print "/inch {72 mul} def";
  print "-90 rotate";
  print "-11 inch 2.2 inch translate";
  print "/LEAD 12 def";
  print "/MAR .25 inch def";
  print "/Times-Roman findfont 10 scalefont setfont";
  print "MAR 4.1 inch MAR sub moveto currentpoint";
  print "/NLshow";
  print "{";
  print "  show moveto";
  print "  0 LEAD -1 mul rmoveto";
  print "  currentpoint";
  print "} def";
}
/^$/ {
  if (foundBlank==0)
  {
    foundBlank = 1;
    print "/Times-Roman findfont 14 scalefont setfont";
    print "4 inch 2 inch moveto currentpoint";
    print "/LEAD 18 def";
  }
  else
  {
    print "showpage"
    print "/LEAD 12 def";
    print "/MAR .25 inch def";
    print "/Times-Roman findfont 10 scalefont setfont";
    print "MAR 4.1 inch MAR sub moveto currentpoint";
    print "/NLshow";
    foundBlank = 0;
  }
  next;
}

{
  print "(" $0 ") NLshow";
}

END {
print "showpage";
}
-- 
Steve Dorner, U of Illinois Computing Services Office
Internet: dorner@garcon.cso.uiuc.edu  UUCP: {convex,uunet}!uiucuxc!dorner
IfUMust:  (217) 244-1765