cvs commit: hints pfs.txt

timothy at linuxfromscratch.org timothy at linuxfromscratch.org
Sat Jul 5 09:31:52 PDT 2003


timothy     03/07/05 10:31:52

  Modified:    .        pfs.txt
  Log:
  Added notes about Epson printers.
  
  Revision  Changes    Path
  1.2       +45 -24    hints/pfs.txt
  
  Index: pfs.txt
  ===================================================================
  RCS file: /home/cvsroot/hints/pfs.txt,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- pfs.txt	2 Jul 2003 12:34:15 -0000	1.1
  +++ pfs.txt	5 Jul 2003 16:31:52 -0000	1.2
  @@ -6,15 +6,15 @@
   
   SYNOPSIS:
   	A very simplistic, yet usable printing setup. Spooler-less. Doesn't
  -	get more simple than this.
  +	get more simple than this. Formerly known as the Printing Minority
  +	Report.
   
   HINT:
   
  -Setting up a Linux box for printing is very easy, much contrary to common
  -belief. If you have simple needs: a printer which is connected to your
  -parallel port, on which you want to print stuff; and that's about it: then
  -there is a simple solution. If you want to share your printer between several
  -computers or anything fancy like this, this hint is not for you.
  +Setting up a Linux box for printing can be very easy. If you your setup is
  +simple: One computer and one printer which you want to communicate, and that's
  +about it, this hint is for you. If you want to share your printer between
  +several computers or anything fancy like this, I cannot help you.
   
   
   SOFTWARE:
  @@ -34,8 +34,8 @@
   command. I submitted the script to Declan, and the next thing I knew was that
   Declan handed over the hint to me.
   
  -Thanks to Declan for the (highly) original hint, and to Bill Maltby for
  -clearing up some issues on how to echo stuff to printers the GoodWay[TM].
  +Thanks to Declan for the original hint, and to Bill Maltby for clearing up
  +some issues on how to echo stuff to printers the GoodWay[TM].
   
   
   STEP 1:
  @@ -62,17 +62,36 @@
   If your printer spits out a piece of paper with the word `blah' on it,
   good. If it doesn't, worry.
   
  +If your printer is an Epson, the above command most probably will not work. In
  +this case, the following info contributed by Jeroen Coumans might help:
  +
  +	Epson printers don't work without first being given a special
  +	character. The gimp-print util escputil is commonly used for that
  +	(it's probably possible to do this without first installing
  +	gimp-print, but I don't know how). This is the command which works for
  +	me (Stylus C80):
  +
  +		escputil -r /dev/usb/lp0 -i
  +
  +You might want to install gimp-print anyway (i won't tell you how, though (but
  +it appears to be a piece of cake)), as Epson printers are poorly supported by
  +Ghostscript. Otherwise, to build just escputil,
  +
  +	./configure && make -C lib && make -C src/escputil
  +
  +worked for me.
  +
   
   STEP 3:
   
  -Install your favourite version of ghostscript.
  +Install your favourite version of Ghostscript.
   
   
   STEP 4:
   
   Type gs -h at a prompt and select your printer from the pageful of drivers
   that it gives up. If your driver is not shown, go back to step 3 and install
  -another version of ghostscript. AFPL and ESP ghostscript differ in what
  +another version of Ghostscript. AFPL and ESP Ghostscript differ in what
   printers are supported. (Hint: some kind of package management comes in handy
   here.)
   
  @@ -82,7 +101,7 @@
   
   and search their database for your printer. You might be told that you need
   some additional software; HPIJS, pnm2ppa, or others. If you do need some extra
  -software, you're on your own. Here we only deal with ghostscript-supported
  +software, you're on your own. Here we only deal with Ghostscript-supported
   printers. (But read on, the hint might still be of use for you.)
   
   
  @@ -93,7 +112,7 @@
   	gs -q -dBATCH -dNOPAUSE -dSAFER -sDEVICE=<your-printer-driver> \
   	-sOutputFile=/tmp/testit <your-file>
   
  -You'll find some ps files in the ghostscript examples directory; with me this
  +You'll find some ps files in the Ghostscript examples directory; with me this
   is /usr/share/ghostscript/8.00/examples/. This command should give you a
   (probably rather large) binary file /tmp/testit; if you're lucky (I was),
   running
  @@ -128,7 +147,7 @@
   and kick yourself for running a machine unusable for ordinary users. If the
   cat command bails out with some 'Cannot write to /dev/lp0' blah, you can
   either decide that only root should be allowed to access your printer, or you
  -can be a little lax on some security issues and do a
  +can be a little lax on some (minor) security issues and do a
   
   	chmod a+rw /dev/lp0
   
  @@ -162,10 +181,11 @@
   cat > /usr/bin/lpr << "EOF"
   #!/bin/bash
   
  -####################  Adjust to your needs.
  +####################  Adjust to your needs/desires.
   DEVICE=ljet4
   LP=lp0
   PAPER=a4
  +LOCKFILE=/tmp/.${LP}-lock
   ####################  End Adjust
   
   # Prints file to printer $DEVICE connected at /dev/$LP, 
  @@ -174,8 +194,8 @@
   
   # Uli Fahrenberg, early 2003. This file is in the public domain.
   
  -if [ -e /tmp/.lp-lock ] ; then
  -	echo "Error: printer is locked  (/tmp/.lp-lock exists)"
  +if [ -e $LOCKFILE ] ; then
  +	echo "Error: printer is locked  ($LOCKFILE exists)"
   	exit 1
   fi
   
  @@ -188,32 +208,33 @@
   
   	FTYPE=$(file -bL $FILE | awk '{print $1}')
   	if ! [ $FTYPE = 'PDF' ] && ! [ $FTYPE = 'PostScript' ] ; then
  -		echo "Error: $FILE should be a PS or PDF file."
  +		echo "Error: $FILE is not a PS or PDF file."
   		exit 1
   	fi
   
   	### Comment this out if you want lpr to be quiet:
   	echo -n "Printing $FILE... "
   
  -	(touch /tmp/.lp-lock;\
  +	(touch $LOCKFILE ; \
  +	trap 'rm -f $LOCKFILE' EXIT ; \
   	gs -q -dBATCH -dNOPAUSE -dSAFER -sDEVICE=$DEVICE \
   	    -sPAPERSIZE=$PAPER -sOutputFile=- $FILE \
  -	> /dev/$LP ; \
  -	rm /tmp/.lp-lock) &
  +	> /dev/$LP ) &
   
   	### Without the sleep, some apps delete $FILE
   	###    faster than gs can read it:
   	sleep 1
  +	### Comment this out if you want lpr to be quiet:
   	echo "Done."
   
  -else ### We are part of a pipe.
  +else ### We have no filename argument, so we try stdin
   	DATA="$(</dev/stdin)"
  -	(touch /tmp/.lp-lock;\
  +	(touch $LOCKFILE ; \
  +	trap 'rm -f $LOCKFILE' EXIT ; \
   	echo "$DATA" \
   	| gs -q -dBATCH -dNOPAUSE -dSAFER -sDEVICE=$DEVICE \
   	    -sPAPERSIZE=$PAPER -sOutputFile=- - \
  -	> /dev/$LP;\
  -        rm /tmp/.lp-lock)&
  +	> /dev/$LP ) &
   fi
   EOF
   chmod 755 /usr/bin/lpr
  
  
  
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe hints' in the subject header of the message



More information about the hints mailing list