Printing without CUPS is very easy once you know a few things.
Step 1: Find the PPD file that belongs to your printer and put it somewhere useful, like /etc/cups/ppd. Then export it:
Code:
export PPD="/etc/cups/ppd/ML1660.PPD"
This is crucial, becuause the filter program expects this magic environment variable to be set.
Step 2: find your filter program and put it somewhere useful. The actual name of this file will vary depending on your printer make & model, but they all do the same basic thing: convert postscript to some compiled binary format.
Code:
CONV="/etc/cups/filters/rastertosamsungspl"
Step 3: find your printer:
Code:
DEV=
DEVS="/dev/usb/lp0 /dev/usb/lp1"
for dev in $DEVS; do
if [ -e "$dev" ]; then
DEV="$dev"
fi
done
Step 4: Convert your document to postscript. Most docs can be exported in OpenOffice/Firefox/etc to PDF. Then you just need pdftops. Other filetypes can be a bit more challenging and you'll need to play around a bit to get your PNG or JPG to look good at the correct size. "convert" from Imagemagick is your friend here.
Code:
convert -page letter "$SFILE" "$PSFILE"
usually works pretty good.
Straight ascii text is easy, a2ps or enscript do a lovely job.
Step 5: Assemble your mystical command to convert postscript to whatever proprietary language your printer speaks.
Code:
GS_OPTS="GS_FONTPATH=/usr/local/share/ghostscript/8.01/Resource/Font/ GS_LIB=/usr/local/share/ghostscript/8.01/"
You may not need that one if you have a nice clean factory set up. Adjust to suit your installation.
Code:
splfile="${psfile/%ps/spl}"
job=1
user="miven"
title="'$file'"
copies=1
opt="-"
#CMD="$CONV 1 1 1 1 1 $psfile > $splfile"
CMD="$GS_OPTS $CONV $job $user $title $copies $opt $psfile > $splfile"
echo "$CMD"
eval $CMD
Y'see, all filter programs have this unspoken industry agreement to supply 5 (and only 5) arguments, plus the exported PPD variable.
Any of these are not met, it will fail silently and you will never know why. I learned by hex editing the source code of the filter program.
These 5 args go into the SPL header so that the print server can ID the file and reroute it or whatever in large print installations.
I'm pretty it's just you and your cheapo USB printer, so the values of the args make no difference whatsoever, as long as they are present.
So if you got that command to work, you should now have a brand new SPL file ready to
Code:
cat $splfile > $DEV
and it will print in full glory. With SSH you can scp the file over to the print server, ssh in, and then print it. All can be done with 1 small bash script. CUPS just hides the details from you.