cvs commit: hints printing_minority_report.txt

timothy at timothy at
Thu May 15 16:20:30 PDT 2003

timothy     03/05/15 19:20:30

  Modified:    .        printing_minority_report.txt
  Changes are mainly to remove typos, and to add a script contributed by Ulrich who has automated it.
  Revision  Changes    Path
  1.2       +112 -37   hints/printing_minority_report.txt
  Index: printing_minority_report.txt
  RCS file: /home/cvsroot/hints/printing_minority_report.txt,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- printing_minority_report.txt	29 Apr 2003 12:49:07 -0000	1.1
  +++ printing_minority_report.txt	15 May 2003 23:20:30 -0000	1.2
  @@ -4,15 +4,18 @@
   AUTHOR:		"Declan Moriarty"<declan.moriarty at>
  -SYNOPSIS:	Printing without all those (expletives deleted) print programs
  +SYNOPSIS:	Quick Easy Printing without all those (expletives deleted) 
  +		print programs
   For those without Postscript printers who get pissed off big time with
   printing programs in linux and only need basic functionality, one
   dissented loser with all this printing crap took the following way out. 
  -We can print without a print program. This is really an anti-cups hint.
  +Printing is accomplished by ghostscript, and a simple but effective script
  +kindly contributed by Ulrich Fahrenberg <uli at>. All the other 
  +preprocessor programs, and post processors that make printing such a drag
  +in linux can be junked. They are ALL redundant bloat!
   Get a Word Processor - Abiword is mine. A hint is there, and it
   worked for me. If it doesn't work for you, argue with him, not me. 
  @@ -38,7 +41,7 @@
   2.  Type gs -h at a prompt and select your printer from the pageful of
   drivers that it gives up. I have a BJC-4000 (bjc600 driver), but like a
   true cheapskate, I use b/w cartridges, so bjcmono suits me. The bjc600
  -driver performs poorly giving colour to a b/w printer. You may then
  +driver performs poorly, giving colour to a b/w printer. You may then
   want to fire up vim and edit the ppd slightly.
   vim /usr/local/share/ghostscript-7.05/filter/bjcmono.ppd
  @@ -48,7 +51,7 @@
   screw up completely, delete and you can do another 'make install'.
   Test this driver by executing the following commands from a console.
  -gs -q --dBATCH -dNOPAUSE -dSAFER -sDEVICE=<your-printer-driver>  \
  +gs -q -dBATCH -dNOPAUSE -dSAFER -sDEVICE=<your-printer-driver>  \
   -sOutputFile=/tmp/testit  <> .
   There are good postscript files in the <ghostscript source>/examples
  @@ -87,16 +90,19 @@
    -sOutputFile=/home/your_dir/rude_word would work just as well. Those
   options mean:
   -q - tells gs not to display anything & saves it looking for X.
  --dBATCH - tells gs to quit after processing your files - always a good
  --dNOPAUSE - tells gs not to play it's usual dance of pressing return to
  -show a page.
  --dSAFER -  tells gs from deleting your file or doing other stupid
  -things like that.
  +-dBATCH - tells gs to quit after processing - always a good idea.
  +-dNOPAUSE - tells gs to skip it's usual dance (requiring a keypress).
  +-dSAFER -  tells gs from deleting or zapping anything.
   -sDEVICE= your printer driver. Be exact and case sensitive. GS is
   stupid.Use the spelling on the info at 'gs -h'.
   -r360 - tells the resolution to use. You may not need this. You hacked
   the ppd, remember? Yours may be different. It's the dpi.
   -sOutputFile= write to this output file (congratulations for guessing!)
   Brew your own cocktail of these options. Refine & remember it, or write
   it down.
  @@ -119,35 +125,40 @@
   at a prompt to check they are being read.
  -6. Usage is as follows: To print from any applications, (e.g. abiword)
  -print to file and you get a postscript file.  Save it. Note in passing
  -that nearly any program can do better <some-format-to-postscript>
  -conversions than the 'print' programs that sell themselves as doing it
  -:-/.  Images can also be sorted in this fashion. Print to file.  Then
  -at any console, type
  -lps < or filename.pdf>    &&    print
  -and you WILL get output. No if, but, or maybe. If it's crap, then you
  -have the wrong print driver. Punish yourself, and go back to step 2.
  -For single page ascii, where you don't want the bother of doing the
  -load/save, you can use either
  -cp <filename> /var/spool/canon && print
  -        or
  -cat  /tmp/header    your_text_file    >  /dev/lp0
  -which will send yourfilename after your blank header file. This can
  -probably be reduced to a single command by someone with the least bit
  -of scripting acumen, but I haven't got that.   When you do it,
  -E-mail me, and I'll gleefully include it and credit you if I can make it 
  -work on my system.
  +6. Usage is as follows: 
  +	1. To use the aliases, print to file from any application, e.g.
  +save a file as /tmp/ from your wp. Then
  +lps /tmp/ && print
  +will write a file of raw data ready for your printer, and send it out to 
  +the printer.
  +	2. To send a text only file, you can either convert it to ps (open 
  +it in a word processor and print to file) or 
  +cp <textfile> /var/spool/canon && print
  +or cat /tmp/header <textfile> >/dev/lp0
  +either of which will send  your filename to the printer after your blank 
  +header file. This can be reduced to a single command by someone with the 
  +least bit of scripting acumen, but I haven't got that. Fortunately,  Ulrich 
  +Fahrenberg <uli at> has, and I have appended the script that he 
  +provided for this as section 10. It works!
   A hidden gotcha is that multipage ascii docs will mess up by
   missing headers and often a few lines between pages. Load them in
   abiword, or any wp that will print to a .ps file, and that will sort
   them neatly into pages. Go around & set defaults to your paper size.
  +Ulrich's script (section 10) ideally needs a text section to send a 
  +header at the top of each page of ascii. If you can dream it up,  
  +script it and send it to me for inclusion. You, of course, will get 
   7. Some tidying up :-D.  Use 'make uninstall' targets on your
   "printing" programs if they exist. Then, if cups
  @@ -199,9 +210,73 @@
   worth downloading for these alone, even if you hate the thing. Unfortunately,
   in real M$ style, they are in abiword's individual .abw format. 
  +10. The first versions of this hint contained an appeal to savants for a 
  +printing script to automate this.
  -Some day, someone may write a reliable printing program in linux, and
  -then this will be unnecessary.
  +This script below (name it lpr locally) takes a .ps or .pdf file and 
  +spits it at the printer, something printer programs seem to find difficulty
  +with ;-). Ulrich Fahrenberg <uli at> contributed this, and we bow 
  +and scrape in his general direction :-).
  +Before you say it doesn't work, revisit point 7 and make sure you cleared all 
  +the other lpr programs out of the path. Install it somewhewre in the path and 
  +chmod it to 755. 
  +Usage is simple: it IS lpr, and does everything a 500K binary would: Print from the 'print' function in anything, or call it from  a command line or script.
  +At a stroke we have obsoleted megabytes of bloated crap associated with 
  +printing. More Power to you, Ulrich!
  +# By Ulrich Fahrenberg <uli at>
  +# Check the arguments to gs suit your printer
  +### Adjust next two lines to your needs.
  +DEVICE=ljet4  	## Your printer driver from 'gs -h' here
  +LP=lp0		## Your printer port 
  +# Prints file to HP LaserJet 1100 connected at /dev/lp0
  +# Usage: `lpr <ps or pdf file>' or `cat | lpr'
  +if [ -e /tmp/.lp-lock ] ; then
  +        	echo "Error: printer is locked  (/tmp/.lp-lock exists)"
  +        	exit 1
  +     	fi
  +if ! [ X$FILE = X ] ; then ### We have a filename as an argument.
  +        if ! [ -r $FILE ] ; then
  +                echo "Error: Cannot read file $FILE"
  +                exit 1
  +        fi
  +FTYPE=$(file -b $FILE | awk '{print $1}')
  +        if ! [ $FTYPE = 'PDF' ] && ! [ $FTYPE = 'PostScript' ] ; then
  +                echo "Error: $FILE should be a PS or PDF file."
  +                exit 1
  +        fi
  +	        echo -n "Printing $FILE... "
  +	        (touch /tmp/.lp-lock;\
  +        gs -q -dBATCH -dNOPAUSE -dSAFER -sDEVICE=$DEVICE \
  +	        -sPAPERSIZE=a4 -sOutputFile=- $FILE > /dev/$LP ; \
  +           	rm /tmp/.lp-lock) & echo "Done."
  +else ### We are part of a pipe.
  +	DATA="$(</dev/stdin)"
  +	(touch /tmp/.lp-lock;\
  +	echo "$DATA" \
  +	-sPAPERSIZE=a4 -sOutputFile=- - \
  +        > /dev/$LP;\
  +        rm /tmp/.lp-lock)&
  +Some day, someone may write a reliable printing program in linux, if it is
  +shorter than this people should convert. Mind you, this is pretty good. And 
  +it will be very difficult to be shorter.
   Declan Moriarty.
Unsubscribe: send email to listar at
and put 'unsubscribe hints' in the subject header of the message

More information about the hints mailing list