121240Swosch#!/bin/sh 221240Swosch# 321240Swosch# make-ps-header - make a PostScript header page on stdout 421240Swosch# Installed in /usr/local/libexec/make-ps-header 521240Swosch# 621240Swosch 721240Swosch# 821240Swosch# These are PostScript units (72 to the inch). Modify for A4 or 921240Swosch# whatever size paper you are using: 1021240Swosch# 1121240Swoschpage_width=612 1221240Swoschpage_height=792 1321240Swoschborder=72 1421240Swosch 1521240Swosch# 1621240Swosch# Check arguments 1721240Swosch# 1821240Swoschif [ $# -ne 3 ]; then 1921240Swosch echo "Usage: `basename $0` <user> <host> <job>" 1>&2 2021240Swosch exit 1 2121240Swoschfi 2221240Swosch 2321240Swosch# 2421240Swosch# Save these, mostly for readability in the PostScript, below. 2521240Swosch# 2621240Swoschuser=$1 2721240Swoschhost=$2 2821240Swoschjob=$3 2921240Swoschdate=`date` 3021240Swosch 3121240Swosch# 3221240Swosch# Send the PostScript code to stdout. 3321240Swosch# 3421240Swoschexec cat <<EOF 3521240Swosch%!PS 3621240Swosch 3721240Swosch% 3821240Swosch% Make sure we do not interfere with user's job that will follow 3921240Swosch% 4021240Swoschsave 4121240Swosch 4221240Swosch% 4321240Swosch% Make a thick, unpleasant border around the edge of the paper. 4421240Swosch% 4521240Swosch$border $border moveto 4621240Swosch$page_width $border 2 mul sub 0 rlineto 4721240Swosch0 $page_height $border 2 mul sub rlineto 4821240Swoschcurrentscreen 3 -1 roll pop 100 3 1 roll setscreen 4921240Swosch$border 2 mul $page_width sub 0 rlineto closepath 5021240Swosch0.8 setgray 10 setlinewidth stroke 0 setgray 5121240Swosch 5221240Swosch% 5321240Swosch% Display user's login name, nice and large and prominent 5421240Swosch% 5521240Swosch/Helvetica-Bold findfont 64 scalefont setfont 5621240Swosch$page_width ($user) stringwidth pop sub 2 div $page_height 200 sub moveto 5721240Swosch($user) show 5821240Swosch 5921240Swosch% 6021240Swosch% Now show the boring particulars 6121240Swosch% 6221240Swosch/Helvetica findfont 14 scalefont setfont 6321240Swosch/y 200 def 6421240Swosch[ (Job:) (Host:) (Date:) ] { 6521240Swosch 200 y moveto show /y y 18 sub def 6621240Swosch} forall 6721240Swosch 6821240Swosch/Helvetica-Bold findfont 14 scalefont setfont 6921240Swosch/y 200 def 7021240Swosch[ ($job) ($host) ($date) ] { 7121240Swosch 270 y moveto show /y y 18 sub def 7221240Swosch} forall 7321240Swosch 7421240Swosch% 7521240Swosch% That is it 7621240Swosch% 7721240Swoschrestore 7821240Swoschshowpage 7921240SwoschEOF 80