Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Mar 1995 08:58:27 +0100
From:      Lars Koeller  <uphya001@odie.physik2.uni-rostock.de>
To:        70312.2134@compuserve.com
Cc:        freebsd-questions@freefall.cdrom.com
Subject:   Re: HP4si with Jet Direct Network Card
Message-ID:  <199503140758.IAA06469@odie.physik2.uni-rostock.de>
In-Reply-To: Mail from 'Tom Stevelt <70312.2134@compuserve.com>' dated: 13 Mar 95 23:04:21 EST

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
   Hello!

      I notice some  time ago some  questions about printing with filtering
   on a remote network printer. I worked out a solution with the well known
   and fairly  good  apsfilter-4.8.1 (aps-481.tgz on ftp.Germany.EU.net  in
   pub/os/Linux/Local.EUnet/People/akl). I do a requing with the normal lpr
   command in apsfilter. lpq and lprm  are very simple scripts which access
   the remote printer by default. The original binaries are renamed to olpq
   and olprm.  Here  are  the  diffs,  my  sample lprm,  lpq,  printcap and
   apsfilterrc files for a PostScript LaserJet IV  with a JetDirect network
   card.  Please send me any suggestions fixes or problems.  I hope it will
   work well with your setup too!

   Regards

   Lars 

------------------------------------------------------------------------------

Lars Köller                        E-Mail: 
University of Rostock (Germany)       lars.koeller@odie.physik2.Uni-Rostock.DE
Fachbereich Physik 		      lars.koeller@physik.Uni-Rostock.DE
Universitätsplatz 3		   Phone:  +49 381/498-1665 or 498-1648
18051 Rostock                      Fax:    +49 381/498-1667




### lprm (in /usr/local/bin) ###

. /etc/apsfilterrc
/usr/bin/lprm -P$REMOTE_PRINTER $*


### lpq (in /usr/local/bin) ###

. /etc/apsfilterrc
/usr/bin/lpq -P$REMOTE_PRINTER $*



### /etc/printcap ###



#######	@(#)printcap	5.3 (Berkeley) 6/30/90
#######
#######
# LABEL apsfilter
# apsfilter setup Tue Dec 13 18:50:27 MET 1994
#
# APS_BASEDIR:/usr/local/lib/apsfilter
#
#
#
lj4.remote|enables remote printing with apsfilter:\
        :rm=lj4.physik2.uni-rostock.de:\
	:sd=/var/spool/PS_600dpi-raw:\
	:lf=/var/spool/PS_600dpi-raw/log:\
	:af=/var/spool/PS_600dpi-raw/acct:\
	:mx#0:
#
ascii|PS_600dpi-a4-ascii-mono|PS_600dpi ascii mono:\
	:lp=/dev/null:\
	:sd=/var/spool/PS_600dpi-a4-ascii-mono:\
	:lf=/var/spool/PS_600dpi-a4-ascii-mono/log:\
	:af=/var/spool/PS_600dpi-a4-ascii-mono/acct:\
	:if=/usr/local/lib/apsfilter/filter/aps-PS_600dpi-a4-ascii-mono:\
	:mx#0:\
	:rg=lp:
#
raw|PS_600dpi-a4-raw|PS_600dpi auto raw:\
	:lp=/dev/null:\
	:sd=/var/spool/PS_600dpi-raw:\
	:lf=/var/spool/PS_600dpi-raw/log:\
	:af=/var/spool/PS_600dpi-raw/acct:\
	:if=/usr/local/lib/apsfilter/filter/aps-PS_600dpi-a4-raw:\
	:mx#0:\
	:rg=lp:
#
lp|PS_600dpi-a4-auto-mono|PS_600dpi auto mono:\
	:lp=/dev/null:\
	:sd=/var/spool/PS_600dpi-a4-auto-mono:\
	:lf=/var/spool/PS_600dpi-a4-auto-mono/log:\
	:af=/var/spool/PS_600dpi-a4-auto-mono/acct:\
	:if=/usr/local/lib/apsfilter/filter/aps-PS_600dpi-a4-auto-mono:\
	:mx#0:\
	:rg=lp:



### diffs for apsfilter in .../apsfilter/bin/apsfilter; Version 4.8.1 ###




*** apsfilter.orig	Tue Dec 13 19:10:41 1994
--- apsfilter	Fri Jan 27 10:26:28 1995
***************
*** 331,349 ****
  
  case $PRINTER in
  
! 	PS_*dpi)	# our printer is a PS printer...	
! 			PRINT_PS="cat -" ;;
  
  	*)		# we have a nice non ps printer
! 			PRINT_PS="	gs				\
! 					-q				\
! 					-sDEVICE=${PRINTER}		\
! 					-r${GS_RESOL}			\
! 					-sPAPERSIZE=${PAPERSIZE}	\
! 					-dNOPAUSE			\
! 					-dSAFER				\
! 					-sOutputFile=-			\
! 					-				" ;;
  esac
  
  if [ "$PRINT_TO_FILE" = "True" ]; then
--- 331,369 ----
  
  case $PRINTER in
  
! 	PS_*dpi)	# our printer is a PS printer...
! 			if [ "$REMOTE_PRINTER" != "" ]; then
! 				PRINT_PS="/usr/bin/lpr -U ${LOGINNAME} -P${REMOTE_PRINTER}  -h"
! 			else
! 				PRINT_PS="cat -"
! 			fi ;;
  
  	*)		# we have a nice non ps printer
! 			if [ "$REMOTE_PRINTER" != "" ]; then
! 				PRINT_PS="	gs			\
! 						-q			\
! 						-sDEVICE=${PRINTER}	\
! 						-r${GS_RESOL}		\
! 						-sPAPERSIZE=${PAPERSIZE}\
! 						-dNOPAUSE		\
! 						-dSAFER			\
! 						-sOutputFile=-		\
! 						- | /usr/bin/lpr 	\
! 							-U ${LOGINNAME} \
! 							-P${REMOTE_PRINTER} \ 
! 							-h"
! 			else
! 				PRINT_PS="	gs			\
! 						-q			\
! 						-sDEVICE=${PRINTER}	\
! 						-r${GS_RESOL}		\
! 						-sPAPERSIZE=${PAPERSIZE}\
! 						-dNOPAUSE		\
! 						-dSAFER			\
! 						-sOutputFile=-		\
! 						-			"
! 			fi ;;
! 
  esac
  
  if [ "$PRINT_TO_FILE" = "True" ]; then
***************
*** 408,414 ****
  
  print_sunraster()
  {
! 	$DECOMPRESS ras2ps $RAS2PS_OPTS | $PRINT_PS 
  }
  
  print_sunraster2()
--- 428,434 ----
  
  print_sunraster()
  {
! 	$DECOMPRESS ras2ps $RAS2PS_OPTS | eval $PRINT_PS 
  }
  
  print_sunraster2()
***************
*** 495,501 ****
  		printf $PRINT_RAW_SETUP_PRINTER
  	fi
  
! 	$DECOMPRESS cat -
  
  	# usually we do a nice formfeed
  	if [ ! $PRINT_RAW_SUPPRESS_FORMFEED ]; then
--- 515,522 ----
  		printf $PRINT_RAW_SETUP_PRINTER
  	fi
  
! 	$DECOMPRESS eval "/usr/bin/lpr -U ${LOGINNAME} -P${REMOTE_PRINTER} -h"
! #		    cat -
  
  	# usually we do a nice formfeed
  	if [ ! $PRINT_RAW_SUPPRESS_FORMFEED ]; then
***************
*** 556,567 ****
  	if [ ! $A2PS_OPTS ]; then
  		# not user defined
  		A2PS_OPTS="${A2PS_BASIC_OPTIONS} \
! 			   ${A2PS_STD_OPTIONS} \
  			   ${A2PS_FEATURES}"
  	else
  		# user defined, but keep BASIC options
  		A2PS_OPTS="${A2PS_BASIC_OPTIONS} \
! 			   ${A2PS_OPTS}"
  	fi
  
  	case $PRINTER in
--- 577,589 ----
  	if [ ! $A2PS_OPTS ]; then
  		# not user defined
  		A2PS_OPTS="${A2PS_BASIC_OPTIONS} \
! 			   ${A2PS_STD_OPTS} \
  			   ${A2PS_FEATURES}"
  	else
  		# user defined, but keep BASIC options
  		A2PS_OPTS="${A2PS_BASIC_OPTIONS} \
! 			   ${A2PS_OPTS} \
! 			   ${A2PS_FEATURES}"
  	fi
  
  	case $PRINTER in
***************
*** 619,625 ****
  		*)	# it's not compressed !
  			DECOMPRESS="";;
  		esac
- 	
  
  	$DECOMPRESS a2ps ${A2PS_OPTS} | eval $PRINT_PS
  }
--- 641,646 ----
***************
*** 632,638 ****
  
  print_data()
  {
! 	$DECOMPRESS cat -
  }
  
  
--- 653,660 ----
  
  print_data()
  {
! 	$DECOMPRESS eval "/usr/bin/lpr -U ${LOGINNAME} -P${REMOTE_PRINTER} -h"
! #		    cat -
  }
  
  
***************
*** 884,889 ****
--- 906,916 ----
  						fault_filetype
  					fi ;;
  
+ 			data | *escape*)
+ 					# that's certainly not critical,
+ 					# you're on your own ;-)
+ 					print_data ;;
+ 
  			*ascii*|*text*|*english*|*script*)
  					if [ "$HAVE_A2PS" = "True" \
  					  -a "$HAVE_GS"   = "True" ]; then
***************
*** 891,901 ****
  					else
  						fault_filetype
  					fi ;;
- 			data)
- 					# that's certainly not critical,
- 					# you're on your own ;-)
- 					print_data ;;
- 
   			*)		
  					# data we - I'm so sorry - don't know
  					fault_filetype ;;
--- 918,923 ----




### /etc/apsfilterrc ###



##############################################################################
#
# Put this file into your HOME directory as $HOME/.apsfilterrc
#
##############################################################################
# 
# Sample .apsfilterrc template file
#
# Enables you to configures some aspects of apsfilter to fit your own needs.
#


##############################################################################
# (1)	Configuration of dvips's feature, to include Postscript pictures
#	into your ".dvi" files during printing. The full description of 
#	this feature is too long, please read your dvips documents.
#	But what you have to know comes here....
##############################################################################
# Description:
# -----------
# If you have or create a Postscript picture for inclusion into a dvi file 
# during "printtime" - a special feature of dvips - then dvips has to know
# about paths, where to look for this PS-pictures.
#
# The "picture search path" has to be set in the TEXINPUTS variable.
# Since you only need this "enhanced" serch path for picture inclusion
# within apsfilter and not for your common TeX environment, you should
# define it here !
#
# Note:
# ----
# You have to define FULL path names !!
#
#	good:	/usr/accounts/andreas/tex-pictures
#	bad:	$HOME/foobar
#
# Example:
# -------
#
#TEXINPUTS=/usr/accounts/andreas/pictures:/usr/share/dvips/pictures

##############################################################################
# (2)	Use your favourite and possibly fater print dvi program ....
#	This feature is only intended for TeXnicians !!!
#	People who are experts in TeX and shell hacking.
#	People who know, that their dvi2xyz print program is faster
#	then the way apsfilter does printing DVI documents:
#		dvips -> "Postscript data" -> gs -> printer
##############################################################################
# Description:
# -----------
# If you have a nicer program to print dvi files, then you can
# define it here in an environment variable. If apsfilter detects
# that a dvi file has to be printed _and_ if this variable is set,
# then apsfilter uses your favourite program, for printing.
#
# Note:
# ----
# Here you are ON YOUR OWN !!!! Your nice program has to provide the 
# following functionality:
#
# - Must have compiled in the correct font search path for TeX fonts,
#   since user environment isn't active when apsfilter is running.
# - Has to be able to read the dvi file from a pipe (stdin)
# - Must be able to send the printer output to standard output (stdout).
# - YOU have to provide a complete working dvi2xxx commandline, that 
#   matches the above mentioned prerequisites. Put this complete command
#   into the below mentioned environment variable.
#
# No working example here, but in general (don't forget the '''s)
#
# PRINT_DVI='/usr/local/bin/my_super_filter -X -Y -Z -'
#
# please again note:
#			- it has to read dvi from stdin !
#			- it has to write print data to stdout !
#			- it has to be called with complete path !
#			- TeX Font searchpaths have to be compiled
#			  in. Another possibility woud be, to try
#			  to set the needed environment variably
#			  in this file ... Try it !
#

##############################################################################
# (3)	Possibility to send special printer ``escape sequences''
#	to initialize the Printer before printing ``raw'' unfiltered text.
##############################################################################
# Description:
# -----------
# Some people reported, that printing long text's or C-Program listsing
# with apsfilter works great, but dog _slow_, since their printer isn't
# fast in printing grafik output (remember, is you print a ascii text, this
# text is first translated by a2ps into postscript, and after that it will
# be piped through gs, which translates Postscript to your printers 
# grafik language .... Only printers like Deskjet 500 and such printers
# are able, to dothat Graphic output reasonably fast.
#
# So people wanted a feature, to skip file type auto recogniton, a2ps and
# gs to print listings and such with full speed.
#
# But some printer, especially HP printer, need some setup commandos,
# to do a carriage return, before the next line is printed, otherwise
# your print output looks like this (runs away to the right side 'til
# you don't see anything ...)
#
#	First line:		Some Text
#	Next line:				sdjhsdjhsd
#	Next line:						sdjhsdjhsd
#
# See your printers manual, what makes sense to be defined here !
#
# Here an example, what is nice to use with a HP Deskjet 500:
# 
#	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
#
#	QUALITY			\E ( s # Q
#				1 = draft	= 240cps
#			**	2 = letter	= 120cps (default)
#
#	TEXT SCALE MODE		\E & k # W
#				5 = off (default)
#				6 = on
#				ignored in landscape mode
#
#	PERFORATION SKIP MODE	\E & l # L
#				0 = off = 0.0 in Top Margin
#				1 = on  = 1/2 in Top Margin (default)
#
#	LEFT MARGIN		\E & a # L
#				# Value = column number
#				default = 0 = 1/8 in left margin
#				used = 7 for 1" left margin
#
#	PITCH			\E ( s # H
#				# = cpi
#				default = 10 characters per inch
#				**	12 cpi
#
# Example:
# -------
# The desired printer setup escape sequence - suitable for printf(1) !!! - 
# looks like this:
#
#PRINT_RAW_SETUP_PRINTER='\033&k2G\033(s2Q\033&k5W\033&l0L\033&a7L\033(s12H'

##############################################################################
# (4)	Do you need a formfeed at the end of a print job or not ?!
#	Here's a way how to suppress it !
##############################################################################
# Description
# -----------
# This is only necessary when printing with lpr -Praw, since in every other
# case everything is managed by gs or a2ps on PS and non PS-printers.
#
# To suppress formfeeds simply set the variable ....
#
#PRINT_RAW_SUPPRESS_FORMFEED=yes

##############################################################################
# (5)	Some of ghostscripts printer drivers have special features.
#	Heres a way of enabling this special features if you need or like.
##############################################################################
# Description
# -----------
# For example most of ghostscripts (gs(1)) Color Deskjet drivers
# supports additionally functionality when printing color text or pictures.
# You should read the documentation that comes with ghostscript's sources
# very closely. An exerpt of this can be found in apsfilters doc directory,
# too. 
#
#GS_FEATURES="-dBitsPerPixel=1"

##############################################################################
# (6)	Some of Linux's teX implementations are very ``weak'' and broken.
#	Especially the MaKeTeX shellscripts are sometimes causing trouble.
#	Here's a way to explicitely enable dvips, to automatically create
#	missing TeX pk fonts, if you are sure, that your TeX distrib is ok
#	and has proper permissions in the font and tfm directory, writeable
#	by everybody !!!
##############################################################################
# Description
# -----------
# I think some Linux TeX packages are a bit broken. Things that worked here
# didn't work on other systems ... No way to support that efficiently ...
#
# Normally the following should happen: 
# If you print dvi files and some TeX pk-fonts are missing, then dvips 
# calls automatically MakeTeXPK or such a script to create the missing ones
# automatically in the proper reolution. A very nice feature !
#
# By default we disabled dvips's auto font creation feature, because,
# many people became much trouble with it.
# 
# Apsfilter exited after the first font was generated and there were
# font creating permission problems, too.
#
# So, you should be able, to help yourself (Unix / TeX hacker), if you
# want that feature ...
#
# So, if you want that feature, you should help yourself in case of
# trouble .... Double check permissions !!!
# The TeX tfm directory and the complete font directory has to
# be world writeable !!!
#
# Perhaps do that as root, change into your tex library directory,
# mostly you find your font directory and tfm directory there ...
# Otherwise look,. where it might be ....
# Then type:
#	find tfm fonts -print | xargs chmod ugo+w
#
# Ater that enable this ;-)
#
HAVE_MAKETEXPK="True"

##############################################################################
# (7)	Here you can determince, how a2ps (ascii to Postscript converter)
#	formats your documents...
#	here you can select between 4 predefined choices
##############################################################################
# Description
# -----------
# FEATURE=1       tell a2ps to print 1 page  on one sheet with    header
# FEATURE=2       tell a2ps to print 2 pages on one sheet with    header
# FEATURE=1n      tell a2ps to print 1 page  on one sheet without header
# FEATURE=2n      tell a2ps to print 2 pages on one sheet without header
# FEATURE=1l      tell a2ps to print 1 pages in landscape with	  header
# FEATURE=1ln     tell a2ps to print 1 pages in landscape without header
#
# Default is
FEATURE=1


##############################################################################
# (8)	Here you can determince, how a2ps (ascii to Postscript converter)
#	formats your documents...
#	In addition to (7) here you can overwrite the whole a2ps
#	default options
##############################################################################
#
REMOTE_PRINTER="lj4.remote"

A2PS_OPTS="-8 -m -r -nu -nP"

# -P$REMOTE_PRINTER"



### End of Mail ###




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?199503140758.IAA06469>