[855] in RedHat Linux List

home help back first fref pref prev next nref lref last post

Re: Connecting To ISP

daemon@ATHENA.MIT.EDU (Jeff Uphoff)
Fri Oct 25 05:46:33 1996

Date: Fri, 25 Oct 1996 05:44:18 -0400
From: Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
To: redhat-list@redhat.com
In-Reply-To: Your message of Fri, October 25, 1996 12:12:27 +0300
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com

"KSA" == Khalid S Al-Khater <kskhater@qatar.net.qa> writes:

KSA> Also, if you have the time. I'm having problem printing on my =
KSA> deskjet500. I setup the printer correctly from the Control Panel
KSA> and = tested my /dev/lp1 connection by issuing : lptest > /dev/lp1
KSA> and it = prints OK!  but printing form X applications does not
KSA> work. I get garbage.

If the X app's are outputting Postscript and the DJ500 doesn't have a
Postscript cartridge (do they even make these for the DJ500?!?) then you
have to convert the Postscript to something that the DJ can understand.

I used to have a filter that did this--there were/are several floating
about--but that was on a 0.99.12+net2e-alpha4 (ahh...life as a guinea
pig for FvK!) system that I finally toasted today and put RH 3.0.3 on.
Sigh...the end of an era--I didn't even need passwords on that system
since I never fixed the 'login -f' bug!  <grin--of course it was a
standalone>

--Up, who has _severe_ insomnia tonight and can't find anything better
to do than babble away on the redhat-list....

P.S. Whee!  I just found a copy of this hidden on another system.  Mind
you, it's *very* old, and is ***unsafe***; it uses /var/tmp in a racey
fashion.  It shows the basic concept though....

#!/bin/sh

# $Id$

# HP Deskjet 500 - output filter - V 1.2
#
# copyright 1993 by Andreas Klemm <andreas@knobel.knirsch.de>
#
# Sat Sep 18 18:57:26 GMT 1993

# where do you have diskspace
#
TmpDir=/var/tmp

# Temp. filename
TmpFile=$TmpDir/deskjetof.$$

# Who should be notified by e-mail in case of print problems ?
NOTIFY=root

# write print data from stdin to temp file
cat - > $TmpFile

#
# reset printer to power on values before print job
#
echo -ne '\033E'

# determine file type
# set output of the ``file'' command to new script arguments $1, $2, ..., $n
#
set -- `file $TmpFile`

# throw away $1 since that is the *file name*
#
shift

# the rest is a "string" which consist of one or multiple words 
# describing the file type. For example: "Korn Shell Script"
#
FileType=$*

case $FileType in

    PostScript*)	#
			# pipe ps data through ghostscript
			#	
			/bin/cat $TmpFile		\
			| /usr/bin/gs -q		\
				-sDEVICE=deskjet	\
				-r300			\
				-sPAPERSIZE=letter	\
				-dNOPAUSE		\
				-sOutputFile=-		\
					-		\
			/usr/local/lib/ghostscript/quit.ps \
			|| echo -ne '\033&l0H'
			# ^  if an error occurs, then
			# |  eject already loaded paper
			;;

    *text*|*script*)	#
			# print normal text with
			#	- cr/nl conversion
			#	- letter quality
			#	- 66 lines/page
			#	- left margin
			#	- 12 cpi pitch
			#

			# LINE TERMINATION	\E & k # G
			#	0 = CR=CR   ; LF=LF   ; FF=FF (default)
			#	1 = CR=CR+LF; LF=LF   ; FF=FF
			# **	2 = CR=CR   ; LF=CR+LF; FF=CR+FF
			#	3 = CR=CR+LF; LF=CR+LF; FF=CR+FF
			echo -ne '\033&k2G'

			# QUALITY		\E ( s # Q
			#   	1 = draft	= 240cps
			# **	2 = letter	= 120cps (default)
			# echo -ne '\033(s2Q'
			echo -ne '\033(s1Q'

			# Text Scale Mode		\E & k # W
			#   	5 = off (default)
			#     	6 = on
			#	ignored in landscape mode
			# echo -ne '\033&k5W'

			# Perforation Skip Mode		\E & l # L
			#   	0 = off = 0.0 in Top Margin
			#   	1 = on  = 1/2 in Top Margin (default)
			# echo -ne '\033&l0L'

			# Left Margin			\E & a # L
			# 	# Valu^ = column number
			#	default = 0 = 1/8 in left margin
			#	used = 7 for 1" left margin
			# echo -ne '\033&a7L'

			# Pitch				\E ( s # H
			#	# = cpi
			#	default = 10 characters per inch
			# **	12 cpi
			# echo -ne '\033(s12H'

			# print tmp file
			/bin/cat $TmpFile
			;;

	*data*)		#
			# print binary files
			#

			# LINE TERMINATION	\E & k # G
			# **	0 = CR=CR   ; LF=LF   ; FF=FF (default)
			#	1 = CR=CR+LF; LF=LF   ; FF=FF
			#   	2 = CR=CR   ; LF=CR+LF; FF=CR+FF
			#	3 = CR=CR+LF; LF=CR+LF; FF=CR+FF
			echo -ne '\033&k0G'

			# print tmp file
			/bin/cat $TmpFile
			;;
			

	*)		#
			# Rest is an unknown file type ...... sorry ;-)
			#

			echo "deskjetof: unknown filetype $FileType" > /dev/console
			echo "deskjetof: $TmpFile: unknown filetype $FileType" \
			| mail $NOTIFY
			NotOk=1
			;;
esac

#
# keep print job, that couldn't be printed because of errors....
#
if [ ! "$NotOk" = "1" ]
then 
	rm -f $TmpFile
fi


#
# reset printer to power on values after print job
#
echo -ne '\033E'


--
  PLEASE read the Red Hat FAQ, Tips, HOWTO and the MAILING LIST ARCHIVES!
  ________________________________________________________________________
  http://www.redhat.com/RedHat-FAQ   http://www.redhat.com/RedHat-HOWTO 
  http://www.redhat.com/RedHat-Tips  http://www.redhat.com/mailing-lists
  ------------------------------------------------------------------------
To unsubscribe: mail -s unsubscribe redhat-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post