NetBSD-Users archive

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

Re: Use network printer from NetBSD



For a simple test you could do something like “cat <file> && printf “\00c" >test_print”  then lpr test_print where <file> is the plain text file your want printed.

My newer printer also supports the 9100 feature, but I don’t use it.  My print cap file just contains:
	# Default handler
	lp:         :sh:lp=:mx#0:rm=192.168.1.2:rp=TEXT_P1:lf=/var/log/lpd-errs:sd=/var/spool/output/lpd:

The filter I used to convert everything to Postscript to send to the printer:
	#\!/bin/sh
	# Check to see if input is PostScript.  If not, pass through enscript.
	read firstline
	firstchars=`expr "$firstline" : "\(..\)"`
 
	if [ "$firstchars" = "%!" ]
	then
	    # PostScript file; pass through $firstline and rest of file
	    echo "$firstline" && cat && printf "\004"
	    exit 0
	else
	    # Not PostScript file; use enscript to process
	    (echo "$firstline"; cat) | /usr/pkg/bin/enscript -p- -L 66 && printf "\004"
	    exit 0
	fi

But if you do something like that you’ll probably want to change your print cap file to send output to the POSTSCRIPT_P1 queue instead of the TEXT_P1 queue since everything should be in Postscript format after applying this filter.  And of course you need to add the reference to the filter in your printcap file.

Hope this helps,
-bob

On Jul 4, 2020, at 9:07 AM, Rocky Hotas <rockyhotas%firemail.cc@localhost> wrote:

> On giu 26  6:45, Robert Nestor wrote:
>> It’s been a few years since I set up my HL-1270N, but as I recall I found the information on the internal queues and the requirement for sending the EOT at the end of a document in the User’s Manual.  And I think  they get listed when I ask the printer to print out a configuration report which can be done from the BRAdmin utility, logging into the printer via web browser or holding down the test button in the back of the printer.
> 
> After (literally) days of attempts, I found something very similar,
> also thanks to what you suggested here. In the web configuration
> interface, I found (as mentioned in a previous message from today):
> 
> Enabled Services
>    BRN3C2AF4E874A2
>    BINARY_P1
>    TEXT_P1
>    POSTSCRIPT_P1
>    PCL_P1
>    BRN3C2AF4E874A2_AT
> 
> Each of them has a minimum possible configuration. For example,
> 
> TEXT_P1
> Service Name	TEXT_P1
> Service Port	P1
> Protocols	TCP/IPIPP
> Filter		Text Substitution
> Control Strings	Beginning of Job	1)
> 		End of Job		11)\0C
> Raw TCP Port	9100
> Service Options	Bi-Directional
> 
> `1)' and `11)' are just the lines of a list menu. It seems (but it's
> just a guess from me) that a plain text stream must not be introduced by
> any character and that must be concluded by `\0c'.
> 
> I tried
> 
> { printf 'test \014%%'; sleep 5; } | telnet <printer_IP> 9100 
> 
> with no success.
> 
> How did you append `\004' to the end of your files with your old Brother
> HL-1270N?
> 
>> I scanned thru the manual on your printer and didn’t find any of the same information, but it looks like that printer has more features than a moon rocket, so I could have missed something though.
> 
> It seems so to me too :).
> 
> Bye!
> 
> Rocky



Home | Main Index | Thread Index | Old Index