#!/bin/sh
# A script to format (compressed) micro reference cards in your format,
# to print them landscape mode on an Imagen laser printer (using the
# Diablo emulation mode).
#
# Andrew Yeomans             PSTN: 0442 230000 ext 3371
# Crosfield Electronics Ltd  INTL: +44 442 230000
# Three Cherry Trees Lane    Fax:  0442 232301
# Hemel Hempstead            UUCP: ajy@cel.uucp
# Hertfordshire              or mcvax!cel!ajy@uunet.uu.net
# HP2 7RH
# England
#

# format card file for printing on laser printer
# seems to be bugs in pr with big image areas

zcat $1 | head -80 > $1.1
zcat $1 | head -160 | tail -80 > $1.2
zcat $1 | tail -80 > $1.3
echo -n '@document(language diablo, printwheel sd_cour06, VMI 4, HMI 6,\
 paperheight 3510, paperwidth 2490, window (8.3 11.7 1), at(8.0 0.6 cc), \
 papermargin 0,\
 lfiscrlf on, htabs yes, jobheader off, copies 1\
)' > $1.prt
pr -3 -m -s -t -l80 -w300 $1.{1,2,3} | head -80 | expand >> $1.prt
lpr -Pnearest $1.prt
rm $1.1 $1.2 $1.3

