View Single Post
  #2   (View Single Post)  
Old 13th April 2009
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,102
Default

Quote:
Originally Posted by unicyclist View Post
I'm running 4.4 stable and trying to setup my printer (HP DeskJet 870C).
I installed LPRng
Why did you install LPRng spooling system? Are you going to run printer printer server with 500 printers and 30 different user groups?
LPD in the base is completely sufficient for a home user including light network printing.

LPRng is based on the same LPD protocol but it was used in 90s for enterprise level printing. It is obsolete. Presently, CUPS with all its weaknesses is de facto standard for enterprise printing. The only new thing that CUPS brings is that supports IPP (Internet Printing Protocol) besides LPD. On the another hand CUPS is very, very complicated peace
of software which is extremely hard to trouble shoot.

Quote:
Originally Posted by unicyclist View Post
and then for more filtering, installed apsfilter.
Very good. Apsfilter is excellent text filter. It does two things. Lets you
edit printcap using GUI script. Secondly, it magically guess what kind of
files you are sending to printer and pass them to appropriate post script
filter before sending them to driver. For instance if you send PDF file it passes the file through pdf2ps and then sends PostScript file to printer if
the printer is capable of speaking PostScript language or to Ghostscript
driver which filters PostScript documents to the low level printer language understandable to your printer (very commonly PCL printer command language).






Quote:
Originally Posted by unicyclist View Post
crw------- 1 root wheel 16, 0 Apr 11 22:39 /dev/lpt0
crw------- 1 root wheel 16, 1 Mar 7 20:43 /dev/lpt1
crw------- 1 root wheel 16, 2 Mar 7 20:43 /dev/lpt2
If you were using native LPD which I strongly advise you to do you will
add yourself to daemon group as in

Code:
more /etc/group
daemon:*:1: daemon,oko
Then change the group for /dev/lpt0 if that is device node where the printer is connected.

Code:
chgrp daemon /dev/lpt0
Then edit permission to

Code:
chmod 0664 /dev/lpt0
So finally it will look something like

Code:
 ls -l /dev/lpt0
crw-rw-r--  1 root  daemon   16,   0 Apr 11 18:13 /dev/lpt0


Quote:
Originally Posted by unicyclist View Post
# APS1_BEGINrinter1
# - don't delete start label for apsfilter printer1
# - no other printer defines between BEGIN and END LABEL
lp|pcl3/unspec;r=300x300;q=medium;c=gray;p=letter;m=auto:\
:lp=/dev/lpt0:\
:if=/etc/apsfilter/basedir/bin/apsfilter:\
:sd=/var/spool/lpd/lp:\
:lf=/var/spool/lpd/lp/log:\
:af=/var/spool/lpd/lp/acct:\
:mx#0:\
:sh:
# APS1_END - don't delete this
Make sure also you have correct permissions on spool/lpd

Code:
# cd /var/spool/lpd
# mkdir lp
# chown daemon:daemon lp
# chmod 770 lp

You could use Magicfilter on FreeBSD to achieve the same functionality.
Magicfilter is not ported to OpenBSD.

I personally recommend Foomatic filter presently over apsfilter since it
apsfilter is little bit stale project and the only advantage it offers is
that has that "GUI" script.

Code:
#       $OpenBSD: printcap,v 1.4 2003/03/28 21:32:30 jmc Exp $
lp|Lj4L|HP Lj4L:\
        :lp=/dev/lpt0:\
        :af=/etc/foomatic/HP-LaserJet_4L-ljet4.ppd:\
        :if=/usr/local/bin/foomatic-rip:\
        :sh:sd=/var/spool/output:\
        :lf=/var/log/lpd-errs:
Photosmart|HP|HP Photosmart 5250:\
        :lp=/dev/ulpt0:\
        :af=/etc/foomatic/HP-PhotoSmart_C5200.ppd:\
        :if=/usr/local/bin/foomatic-rip:\
        :sh:sd=/var/spool/output:\
        :lf=/var/log/lpd-errs:
If you promise yourself not to send anything to your printer but PostScript files you can get a way with the following printcap

Code:
lp|local|HP:\
       :lp=/dev/lpt0:\
        :sd=/var/spool/output:\
        :lf=/var/log/lpd-errs:
        :sh:mx#0:if=/usr/local/libexec/lpfilter-ps:
Where lpfilter-ps is my home made PostScript filter (script) which must have permission 0775
and looks like this

Code:
#!/bin/sh
# Treat LF as CR+LF
printf "\033&k2G" || exit 2
# Print the postscript file
/usr/local/bin/gs -dSAFER -dBATCH -dQUIET -dNOPAUSE -q -sDEVICE=ljet4 \
-sOutputFile=- -sPAPERSIZE=letter - && exit 0
exit 2
Replace ljet4 with the name of the driver for your printer and papersize
with a4 if you live outside of US.


Finally a few comments about LPRng.
It was abandoned by its creator Patrick Powell in 2005 after 20 years of development and picked by somebody
else in 2006. It is much harder to use than CUPS for enterprise printing in its present form on OpenBSD since GUI interface LPRngTool for LPRng has never been ported to OpenBSD. There is a special filter IFHP Filter written
for LPRng which has never been ported to OpenBSD. It was unmaintained for a long time. I know that LPRng does
not require IFHP so you should be able to use foomatic-filter( http://enc.com.au/docs/lprngfoo.html ) . Unfortunately foomatic-configure currently cannot handle printcap files in the lprng style. As lprng can use BSD style printcaps this is not much of a problem, as long as the GUI based print manager lprngtool is not used.

On the bright side I just noticed that LPRng web-site has been updated and that the the new version LPRng-3.8.33
has been released March 17th. Hopefully, LPRng can kick some CUPS ass.

Last edited by Oko; 13th April 2009 at 02:41 AM.
Reply With Quote