|
NetBSD General Other questions regarding NetBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
Printer setup question
Hello,
I setup my lpd and printcap for my Brother laser printer (PostScript enabled) on my NetBSD system. The problem I am having is that the filter I wrote for it creates an error when handling shell script files. I think the error comes when the filter tries to process the files commands instead of printing them, but I am unsure of how to fix it. Here is my /etc/printcap: Code:
lp|local printer|Brother HL-5240 :lp=/dev/ulpt0:sd=/var/spool/lpd/lp:lf=/var/log/lpd-errors:\ :sh:mx#0:if=/usr/pkg/bin/t2ps-filter: I took the filter straight out of "FreeBSD: The Complete Reference". Here is the t2ps-filter: Code:
#!/bin/sh # Check to see if input is PostScript. If not, pass through enscript. read firstline firstline=`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- \ && printf "\004" exit 0 fi
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
|||
You don't define the variable ${firstchars}.
Code:
read firstline firstline=`expr "$firstline" : '\(..\)'` if [ "$firstchars" = "%!" ] Code:
read firstline firstchars=`expr "$firstline" : '\(..\)'` if [ "$firstchars" = "%!" ]
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
Hello,
Quote:
Code:
firstchars=`expr "$firstline" : '\(..\)'`
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
|||
Hello,
I can print regular text files fine. The problem is when I try to print a shell script text file (i.e., try to print the t2ps-filter).
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
||||
Ok then, what happens when you cat a shell script through t2ps-filter?
$ cat /usr/pkg/bin/t2ps-filter | /usr/pkg/bin/t2ps-filter It worked for me (at least, the logic did: I don't have /usr/pkg/bin/enscript on FreeBSD). Perhaps the printer is trying to interpret #! as..., no wait, it should be getting postscript. No, I have nothing. OH, and please don't just tell us that it gives you 'an error'. WHAT ERROR??!??
__________________
The only dumb question is a question not asked. The only dumb answer is an answer not given. Last edited by robbak; 17th June 2008 at 01:01 AM. |
|
|||
Hello,
I don't know why, but it is working now! It didn't work for me all yesterday, and now it does. I have one more question on the subject of printing. I am using enscript, which allows for different fonts with the --font=name switch. Which font should I use to get all the characters to print correctly? The default is messing up at least one. In particular, I need "`" to print differently than "'". The default font enscript uses prints both characters identically. I tried a couple others - Courier12; Courier@12, which is straight from the man pages didn't even print for me - and got nowhere.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) Last edited by JMJ_coder; 17th June 2008 at 01:09 AM. |
|
|||
Hello,
Quote:
Code:
ERROR NAME; undefined COMMAND; e OPERAND STACK;
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
||||
Without looking at the data it was sending the printer (which you can get with that cat trick), I couldn't say. It looks like it was barfing over something in enscripts dialect of postscript, to my mind. Your font fiddling may have inadvertently fixed it.
I'm afraid that I don't know enough of the internals of postscript to advise you about fonts. For this basic usage, I'd suspect you are limited to fonts that are embedded in the printer. You may find what fonts are available in the printer's manual.
__________________
The only dumb question is a question not asked. The only dumb answer is an answer not given. |
|
|||
Hello,
Quote:
Actually, when I started to tweak the fonts, it gave me garbage again - when it even printed. I had to quickly fix the syntax of the script. And actually, I found that if I just use the enscript command instead of trying to incorporate it in the filter it works ten times better. I think I will just alias lpr to enscript. Quote:
I'll have see if I can scrounge up a better font, because on this setup I am printing a lot of source code - including shell scripts with 's and`s galore. I need a monospaced font that properly prints all of my common characters. Thanks for the help.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
|||
I'm revisiting this question as I setup my laptop to use my printer. I'm half tempted to just install cups and give that a go. But, if I can, I think the base lpr daemon should work fine. I'm either going to print plain text, or I can get non-plain text into a .ps file that can be printed.
I have two questions: Does the print output of programs such as Firefox (or any browser) and OpenOffice play nice with the lpr daemon? Does it need to be configured with any special options for that? I had problems with fonts before. Basically the lpr daemon - whatever font it used didn't print every character I needed. Noteably a backtick - ` - was printed as a single quote - ' -. You can imagine the difficulties when I printed out things such as shell scripts. The lpr man page says: Code:
-[1234]font Specifies a font to be mounted on font position i. The daemon will construct a .railmag file referencing the font pathname.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
||||
Quote:
I will give you three suggestions: 1. Note that your Brother HL-5240 (good choice by the way) also speaks Printer Command Language 6. Yes, I do know that theoretically it should be easier just to use as Post Script printer but sometimes the theory and practice are not the same. 2. Also look at Apsfilter. Apsfilter is the simple script which will allow you to install printer. Actually it will just generate proper printcap file for you. It can be used on Post Script Printers as well as the one using drivers from Ghostscript, Gutenprint, and HPIJS. 3. Finally, you can use the same PPD file you are using in CUPS without installing CUPS. Look at the foomatic-filter. To answer your second question is more tricky. Whether you can use LPR directly from Firefox or OpenOffice depends on the guy who ported it to NetBSD. If he kept vanilla configuration than I assume that these applications will expect CUPS. However they will be more than happy to print to post script file which you can pipe to the printer. You can obviously configure OpenOffice and Firefox to do this automatically. The advantage of CUPS is that it speaks internet printing protocol IPP unlike LPR which speaks only lpr protocol. The IPP allows printer to report back to the computer its status. In reality only very expensive printers speak full IPP. PPD files among other things describe how to fake IPP conversation with the particular printer. Cheers, OKO Last edited by Oko; 5th November 2008 at 06:01 PM. |
|
|||
Thanks Oko. I did end up installing CUPS, for the simple fact that right now it is the lowest common denominator. I know it will work, and I know how to configure it - and I need to print. As I learn the lpd, which I intend to do, I can then revisit whether CUPS has a place in my userland. Probably over the Christmas break I will re-do my installation, and a lot of these questions will then be re-evaluated.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Printer dont take rights | mururoa | FreeBSD General | 3 | 5th October 2009 12:54 PM |
FBSD 7.1 and Canon LBP-660 Printer | Calderon | FreeBSD General | 8 | 4th May 2009 07:04 AM |
Question regarding wireless setup | stealintv | FreeBSD General | 5 | 19th September 2008 07:36 PM |
IP Printer Setup | kjemison | FreeBSD General | 4 | 2nd June 2008 02:35 PM |
Cups + USB-Printer | nihonto | OpenBSD Packages and Ports | 3 | 21st May 2008 07:49 PM |