#!/bin/bash
#
# This is a filter, suitable for /etc/printcap, that allows simple
# use of an Epson Stylus C66 as a line printer for printing out
# ASCII files.   Some might call it a kludge.
#
# But I had my reasons for wanting to do things this way.  For one thing,
# it was my first encounter with USB, and I'd already spent too much
# time figuring that out.
#
# For another, I didn't want to take time to sort out the CUPS
# documentation, to recompile ghostscript, etc.   Additionally, I
# wanted to do  something that would work with the Debian 'Woody'
# version of lprng for spooling and setting up network-accessible
# printers.
#
# This won't work for PostScript and PDF files, only for plain text.
# But maybe it will be useful to somebody.   I called it
# /usr/local/bin/txt2c66.sh 
# 
# USAGE:
# For example, as root I can type
#
#   # cat testfile.txt | /usr/local/bin/txt2c66.sh >/dev/usb/lp0
#
# By making txt2c66.sh the "if" parameter for lp in /etc/printcap,
# I can type, as a normal user,
#
#     $ lpr testfile.txt
#
# where /etc/printcap contains:
#
#  lp|Generic dot-matrix printer entry:\
#          :lp=/dev/usb/lp0:\
#          :sd=/var/spool/lpd/lp:\
#          :af=/var/log/lp-acct:\
#          :lf=/var/log/lp-errs:\
#          :pl#66:\
#          :pw#80:\
#          :pc#150:\
#          :mx#0:\
#          :sh:\
#          :if=/usr/local/bin/txt2c66.sh:
#  
#   
# I figured this out
# (1) by reading an article  
# called "Taming the Horrors of Printers and Printing, Part 1" by Marcel Gagné
# http://www.linuxjournal.com/node/5332
# and
# (2) by looking at the README that came with
# gimp-print_4.2.0.orig.tar.gz (which I think I downloaded from www.debian.org)
#
# To get this all working, I had to load the right modules for
# USB (usb-ohci), ensure that the permissions are correct (--I used 755--) and that
# the lpd daemon has been restarted, etc.   I also used 'checkpc' and worked
# things out for network access to the printer (cf.  /etc/lprng/lpd.perms).
#
# The following 'echo' takes the C66 out of "packet mode"--this is
# borrowed from the C program "escputil" which is part of the gimp-print package
# The same information can be found at www.epson.com in the files
# C6xSeries.pdf escp2_98.pdf

echo -n -e '\000\000\000\033\001@EJL 1284.4\n@EJL     \n\033@'

# this passes stdin to stdout
cat

# this does a final form feed.
echo -n -e '\f'


For more information, contact Philip Ansteth, 918-743-6342; 575-776-2468; 918-747-0163

Valid HTML 3.2!