Printing a text file

Printing a text file is one of those basic things you never think about. Unless you are me. I like to play with the variables and make that printout look good.

#!/bin/sh
# Print a UTF-8 document to the default printer
# Written by Hal Canary 2009-12-23.
#DTPD# Dedicated to the Public Domain.

# Configurable Options
font="Monospace 11"
#font="Serif 11"
#font="Sans 11"
paper="letter"
b_margin=0.25
t_margin=0.25
r_margin=0.25
l_margin=0.75

# convert inches to PostScript points
b_margin=`echo "( $b_margin * 72 ) / 1" | bc`
t_margin=`echo "( $t_margin * 72 ) / 1" | bc`
r_margin=`echo "( $r_margin * 72 ) / 1" | bc`
l_margin=`echo "( $l_margin * 72 ) / 1" | bc`

exec paps --font="$font" \
  --paper="$paper" \
  --bottom-margin=$b_margin \
  --top-margin=$t_margin \
  --right-margin=$r_margin \
  --left-margin=$l_margin \
  "$@" | lpr
#EOF#