Aaron Brown on Mon, 9 Aug 1999 14:09:57 -0400 (EDT)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [Plug] Printing binary files & "raw" mode?


I had this problem a while ago, I couldnt print to a HP jetdirect server
on our network, Since i had an NT server on the network, I just set up
samba as a network workstation, and I am able to print using SMB in
printtool.

Rune

On Mon, 9 Aug 1999, Edward J. Sager wrote:

:Date: Mon, 09 Aug 1999 13:46:48 -0400
:From: Edward J. Sager <ed@sagers.org>
:Reply-To: plug@lists.nothinbut.net
:To: plug@lists.nothinbut.net
:Subject: Re: [Plug] Printing binary files & "raw" mode?
:
:I don't know if this helps, but here is a PERL script that can print
:directly to a JetDirect device.  I got this from RedHat's site and
:modified it slightly to be callable by lpr.  It assumes the IP address of
:the JetDirect card is lpsample.yourdomain.com or whatever.  You can
:integrate into lpr with the directions below or just pipe binary output
:right to this script.
:
:If you want to integrate in lpr, make the directory
:"/var/spool/lpd/lpsample and add the following lines to /etc/printcap:
:
:lpsample:\
:    :sd=/var/spool/lpd/lpsample:\
:    :lp=/dev/null:\
:    :if=/etc/lpsample.pl:
:
:Then create the following PERL script in /etc/lpsample.pl
:
:#!/usr/bin/perl
:
:($them,$port) = @ARGV;
:
:# your printer initializations here
:$dpi300     = "\x1B*t300R";
:$dosCr      = "\x1B&k3G";
:$ends = "\x0A";
:
:# set defaults in case no command line options
:$port =  9100;
:$them = "lpsample.yourdomain.com";
:
:$AF_INET = 2;
:$SOCK_STREAM = 1;
:$SIG{'INT'} = 'dokill';
:$sockaddr = 'S n a4 x8';
:
:chop($hostname = `lpsample`);
:($name,$aliases,$proto) = getprotobyname('tcp');
:($name,$aliases,$port) = getservbyname($port,'tcp')
: unless $port =~ /^\d+$/;;
:($name,$aliases,$type,$len,$thisaddr) =
:gethostbyname($hostname);
:($name,$aliases,$type,$len,$thataddr) = gethostbyname($them);
:$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
:$that = pack($sockaddr, $AF_INET, $port, $thataddr);
:
:if (socket(S, $AF_INET, $SOCK_STREAM, $proto)) {
:#    print "socket ok\n";
:}
:else {
:    die $!;
:}
:# Give the socket an address.
:if (bind(S, $this)) {
:#    print "bind ok\n";
:}
:else {
:    die $!;
:}
:
:# Call up the server.
:
:if (connect(S,$that)) {
:#    print "connect ok\n";
:}
:else {
:    die $!;
:}
:
:# Set socket to be command buffered.
:
:select(S); $| = 1; select(STDOUT);
:
:#  I didn't want a banner
:#    print S "@PJL ECHO Hi $hostname! $ends";
:#    print S "@PJL OPMSG DISPLAY=\"Job $whoami\" $ends";
:#    print S $dpi300;
:
:# Avoid deadlock by forking.
:
:if($child = fork) {
:    print S $dosCr;
:    print S $TimesNewR;
:
:    while (<STDIN>) {
:        print S;
:    }
:    print S "\f";
:    sleep 3;
:    do dokill();
:} else {
:    while(<S>) {
:        print;
:    }
:}
:
:sub dokill {
:    kill 9,$child if $child;
:}
:
:
:
:
:
:
:_______________________________________________
:Plug maillist  -  Plug@lists.nothinbut.net
:http://lists.nothinbut.net/mail/listinfo/plug
:


_______________________________________________
Plug maillist  -  Plug@lists.nothinbut.net
http://lists.nothinbut.net/mail/listinfo/plug