Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jul 1996 11:03:26 -0700 (PDT)
From:      Wayne Hernandez <hernanw@FSL.ORST.EDU>
To:        questions <freebsd-questions@freebsd.org>
Subject:   ghostscript and remote printers
Message-ID:  <Pine.SUN.3.91.960719105057.20034A-100000@picea.FSL.ORST.EDU>

next in thread | raw e-mail | index | archive | help

I seem to be unable to print ps files to a hp laserjet ii on a jetdirect 
card.  I can print plain text files fine.

When using gs from the command line, it always wants me to enter quit.

This is my /etc/printcap entries:
fsl363|3|ljII:\
        :sh:\
        :if=/usr/lib/hpnp/hplj.if.sh:\
        :of=/usr/lib/hpnp/hplj.of.sh:\
        :lp=/dev/null:\
        :lf=/var/log/lpd-errs:\
        :sd=/var/spool/fsl363:

#
# test for print ps file on fsl363
#
ps|LJII Postscript (Ghostscript PS->PCL Conversion):\
        :lp=/dev/null:\
        :sd=/var/spool/ps:\
        :lf=/var/log/lpd-errs:\
        :of=/usr/local/bin/gslj:\
        :sh:

This is gslj:
#!/bin/sh
PRINTER=fsl363
GS_LIB=/usr/local/lib/ghostscript/fonts
export PRINTER GS_LIB
exec gs -q -sDEVICE=laserjet -r300 -dNOPAUSE -- gslp.ps --heading-center 
"`date`" "$@"

I won't include hplj.if.sh, since it's large, but it calls 
/usr/local/libexec/netprint $PERIPH $PORTS

which is:
#!/usr/local/bin/perl
#
#  netprint - Text filter for printer attached to network
#  Installed in /usr/local/libexec/netprint
#

$#ARGV eq 1 || die "Usage: $0 <printer-hostname> <port-number>";

$printer_host = $ARGV[0];
$printer_port = $ARGV[1];

require 'sys/socket.ph';

($ignore, $ignore, $protocol) = getprotobyname('tcp');
($ignore, $ignore, $ignore, $ignore, $address)
    = gethostbyname($printer_host);

$sockaddr = pack('S n a4 x8', &AF_INET, $printer_port, $address);

socket(PRINTER, &PF_INET, &SOCK_STREAM, $protocol)
    || die "Can't create TCP/IP stream socket: $!";
connect(PRINTER, $sockaddr) || die "Can't contact $printer_host: $!";
while (<STDIN>) { print PRINTER; }
# printf "\f";
exit 0;





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SUN.3.91.960719105057.20034A-100000>