DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 2nd November 2014
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,102
Default LPD printing

I know that many people were very frustrated when upstream broke foomatic-rip for LPD users. Thanks to Antoine Jacoutot of OpenBSD many of us will be CUPS free for years to come. I am leaving internet trace for people who would be looking for the info but Antoine documentation which comes with OpenBSD

/usr/local/share/doc/pkg-readmes/cups-filters*

is golden standard.

In the nut shell what I did:

0. Install foomatic-rip, drivers (in my case hpijs), a2ps, ImageMagick

1. Edit /etc/printcap as
Code:
lp|HP|HP-PhotoSmart_C5200:\
        :lp=/dev/ulpt0:\
        :if=/etc/foomatic-rip/script.sh:\
        :sh:sd=/var/spool/output:\
        :lf=/var/log/lpd-errs:
2. Create /etc/foomatic-rip.script.sh and make it executable

Code:
#!/bin/sh

/usr/local/bin/a2ps -BRq --columns=1 -o - | \
        /usr/local/bin/foomatic-rip -P HP-PhotoSmart_C5200 --ppd \
        /etc/foomatic-rip/direct/hp-photosmart_c5200_series-hpijs.ppd
3. Add hp-photosmart_c5200_series-hpijs.ppd to /etc/foomatic-rip/direct. You can either find it in the database or use foomatic-ppdfile to create it.

4. Adjust permission on ulpt0 and ugen devices.

5. Start lpd daemon and be happy camper.
Reply With Quote
  #2   (View Single Post)  
Old 2nd November 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Thanks. After years of struggling to avoid cups, I ended up having to deploy it for a printer that would not work properly with foomatic-rip.

I console myself knowing that I have the ability to use hplip-gui with it.
Reply With Quote
  #3   (View Single Post)  
Old 20th December 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Quote:
Originally Posted by jggimi View Post
Thanks. After years of struggling to avoid cups, I ended up having to deploy it for a printer that would not work properly with foomatic-rip.

I console myself knowing that I have the ability to use hplip-gui with it.
Today, I reverted to lpd(8). Once again, CUPS had failures with terrible diagnostics. I've removed it and everything that depended upon it. (I still have the cups-filters and cups-libs installed, they are dependencies of other packages that require them.) Now, I'm just using my simple Postscript printer and a plain PPD file.
Reply With Quote
  #4   (View Single Post)  
Old 20th December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 652
Default

Hrm, I thought I saw Oko mention foomatic being broken for FreeBSD as well. (Which, at least judging from a one person experience with one printer that was definitely working in November, seems to be the case.)

I may look into this method, though I'm not sure how much time I'm willing to put into it. I don't have any big prejudice against cups, which as worked well for me for quite awhile--to be honest, since Apple bought it. However, whatever happened to foomatic is annoying.

I print so infrequently, this is more something I would do just out of curiosity--it is annoying though, that a printer that worked before (in 9.x?) stopped working. If I do try the lpd method, I'll follow up here.
Reply With Quote
  #5   (View Single Post)  
Old 20th December 2014
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 scottro View Post
Hrm, I thought I saw Oko mention foomatic being broken for FreeBSD as well. .
It is not BSD specific. foomatic is broken for LPD spooling period. The major Linux distro use CUPS so hence not much noise. Apparently according to authors of foomatic we should all be using CUPS or not using spooling system at all. My guess it is broken for LPRng as well since LPRng is just LPD on steroids.

Last edited by Oko; 21st December 2014 at 02:38 AM.
Reply With Quote
  #6   (View Single Post)  
Old 21st December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 652
Default

Ah, I see, thank you.

One oddity I found was that though CUPS said it was using the 2170W filter, I didn't find such a ppd. I found others in the foomatic directory. In the end, I wound up using a variation on Warren Block's version of using lpd
http://www.wonkity.com/~wblock/docs/...dprinting.html. However, as my printer can use postscript, rather than his script to use ghostscript to translate ps to pcl, I used the Handbook's version of a filter script, which just calls enscript to turn a file into ps. (As I can't find a 2170W ppd, I thought that Oko's script wouldn't work for me. Mine's a networked printer, so there are other slight differences, more or less taken from Warren Block's page. It's working for me, at any rate.

Annoying though--printing from FreeBSD was trivial for awhile there--I see a post of mine on their forums from November, mentioning how it almost worked out of the box. I'm thinking that was with a 9.x install, or at least, an older version of foomatic and/or cups. Anyway, thank you Oko, I was just going to write it off and your post made me decide to go and check out using lpd, despite my inherent laziness.
Reply With Quote
  #7   (View Single Post)  
Old 21st December 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

My reversion to lpd(8) includes foomatic-rip in "direct" mode, using the JetDirect port 9100.
  1. This allows me to print PDFs as well as Postscript files, and
  2. I can set print options by spool queue.
/etc/printcap:
Code:
# Default printer.  Postscript or PDF only, using foomatic-rip (print/cups-filters).

lp|m451mw|HP LaserJet Pro 400 model m451mw:\
        :lp=9100@printer:\
        :if=/usr/local/libexec/foomatic.filter.default:\
        :sd=/var/spool/output:\
        :lf=/var/log/lpd-errs:\
        :sh:

# Same printer, using No. 10 Envelope and manual feed.
# These are 4.25" high and 9.5" wide.  

env|m451mw|HP LaserJet Pro 400 model m451mw:\
        :lp=9100@printer:\
        :if=/usr/local/libexec/foomatic.filter.env10:\
        :sd=/var/spool/output-env:\
        :lf=/var/log/lpd-errs:\
        :sh:
/usr/local/libexec/foomatic.filter.default
Code:
#!/bin/sh

/usr/local/bin/foomatic-rip --ppd /etc/foomatic/direct/hp-lj_300_400_color_m351_m451-ps.ppd
/usr/local/libexec/foomatic.filter.env10
Code:
#!/bin/sh

/usr/local/bin/foomatic-rip --ppd /etc/foomatic/direct/hp-lj_300_400_color_m351_m451-ps.ppd \
  -o InputSlot=Tray1_man -o PageSize=Env10
Reply With Quote
  #8   (View Single Post)  
Old 21st December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 652
Default

So, you also have the ppd for your printer. (I also, at one point, tried generating a ppd at openprinting.org and using that with cups to create the printer. That didn't work either. I am able to print
pdfs with lp whatever.pdf without problem--actually, IIRC, that's doing better than it does on Linux, where I think I often wound up with postscript gibberish, and wound up using evince (on a CentOS-6.6 desktop-cum-server).

Not sure if it will be useful to put my own printcap file but in case it might help someone else--almost all taken directly from the links I gave earlier.

/etc/printcap
Code:
lp:\
	:lp=:\
	:sh:\
	:mx#0:\
	:rm=192.168.1.51:\
	:rp=raw:\
	:sd=/var/spool/lpd/lp:\
	:if=/usr/local/libexec/ps2pcl:\
	:lf=/var/log/lpd-err:
Again, I followed wblock's instructions for creating /var/spool/lpd/lp and an error log file, and used the Handbook's suggested enscript file. For that I installed the port print/enscript-letter (as I'm in the US, usually using letter size paper) and the /usr/local/libexec/enscript script just reads
Code:
#!/bin/sh
/usr/local/bin/enscript -o -
At work, where we have a Kyocera multifunction, however, I use cups and a ppd file that I found somewhere, which I haven't been able to find since, so if I've reinstalled, or installed to another machine, I just copy over the original ppd file. I think I got it from their site, but I really don't remember.

NOTE: See my later post--originally the if line was for enscript, however, in fooling around it seems that it requires that script of Warren's that converts from postscript to pcl.

Both work and the home machines are running FreeBSD-10.1. I also have an HP multifunction here, (at home) that I only use as scanner. I think I used hplip to get that working, haven't set it up though with the newer installs. Maybe I'll try tomorrow if I have time.

Last edited by scottro; 21st December 2014 at 11:44 PM.
Reply With Quote
  #9   (View Single Post)  
Old 21st December 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Quote:
Originally Posted by scottro View Post
So, you also have the ppd for your printer.
Yes, after many years of Ghostscript conversion, I acquired a Postscript printer. The PPD file comes from the manufacturer, HP, and is included in the hpijs subpackage of print/hplip. HP may have produced it but they did not make it something easy to obtain directly, when I went looking for it after I acquired the printer about 14 months ago.
Reply With Quote
Old 21st December 2014
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 scottro View Post
So, you also have the ppd for your printer. (I also, at one point, tried generating a ppd at openprinting.org and using that with cups to create the printer. That didn't work either. I am able to print
pdfs with lp whatever.pdf without problem--actually, IIRC, that's doing better than it does on Linux, where I think I often wound up with postscript gibberish, and wound up using evince (on a CentOS-6.6 desktop-cum-server).
Evince is now broken (Springdale 6.6). I had to install a2ps on our work desktops and ask people to print from the command line or use Xpdf.


Quote:
Originally Posted by scottro View Post
Not sure if it will be useful to put my own printcap file but in case it might help someone else--almost all taken directly from the links I gave earlier.

/etc/printcap
Code:
lp:\
	:lp=:\
	:sh:\
	:mx#0:\
	:rm=192.168.1.51:\
	:rp=raw:\
	:sd=/var/spool/lpd/lp:\
	:if=/usr/local/libexec/enscript:\
	:lf=/var/log/lpd-err:
If you have PostScript printer you can remove input filter (if line) from printap file a most applications will by default convert things to PostScript when requested to print.

Quote:
Originally Posted by scottro View Post
At work, where we have a Kyocera multifunction, however, I use cups and a ppd file that I found somewhere, which I haven't been able to find since, so if I've reinstalled, or installed to another machine, I just copy over the original ppd file. I think I got it from their site, but I really don't remember.

Both work and the home machines are running FreeBSD-10.1. I also have an HP multifunction here, (at home) that I only use as scanner. I think I used hplip to get that working, haven't set it up though with the newer installs. Maybe I'll try tomorrow if I have time.
PPD files are unnecessary with LPD because LPD speaks only LPD network protocol not more advice IPP protocol which is required for toner/paper status and more advanced features. Actually the real tragedy is that no spooling system except CUPS speaks IPP (it was in works for LPRng but never got finished). LPD is really not suitable for enterprise environment (complex printing policies) and advance notifications but it is definitely more than enough for small Lab/Business. LPRng was created to address those short comings but became stale which ultimately allow corporate backed (Apple) CUPS to take over.

You can by basic monochromatic laser PostScript printer here in U.S. for under $100. I have seen it as low as $70 these days in OfficeDepot.

I am not a big fun of HPLIP. I have several older Epson Perfection scanners which work out of box with default SANE-backends. I am talking scanning on my OpenBSD desktops and laptops. Most newer better devices will be happy to scan to USB or SSD or even more conveniently directly to e-mail so really no drivers or any setup is necessary with UNIX or anything else for that matter. Hell even my kids' HP Photosmart C5250 which we keep around as a memory card reader since ink is insanely expensive will scan into SD card. You can probably find one of those for free or for $3 in Goodwill stores.

Last edited by Oko; 21st December 2014 at 05:02 AM.
Reply With Quote
Old 21st December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 652
Default

Thanks, tonight, I am going to remove that enscript line and see what happens. I'll update tonight.

I'm not going to be replacing either printer for awhile--only my wife likes printing in color and she now has something at her studio, an HP multifunction laser, so no more paying insane ink prices. Therefore, the HP I have just works as scanner. I think there is some option to webscan as you mention, but actually, we have so little use for it that I doubt I would bother researching.
Reply With Quote
Old 21st December 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

PPDs can be useful to printing applications. They inform the application about printer capabilities, and can be very detailed. Mine includes all the possible pre-set paper sizes (413 plus custom), printable area, colorspace (RGB), built-in fonts (85), available RAM (73M) .....

I'm OK with Foomatic dropping LPD as a built-in queue method, because the "direct" method can still be used with LPD.

CUPS and the many add-ons provide many more connectivity options and print management capabilities. But ... to get printout from an application to arrive successfully at printer is, under the covers, a little like operating a Rube Goldberg machine. There are a vast number of moving parts. When one of those fail, it's a nightmare trying to conduct problem source identification and resolution.
Reply With Quote
Old 21st December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 652
Default

Well, I don't know what happened, but somehow that broke printing completely. Trying to print something gave me one of those pages of postscript gibberish. So, tried again, both with enscript and with the ps2pcl script of Warren's, but no luck, plus a couple of jams when it started running pages and pages through the printer. (And as it's a cheap printer, I couldn't find a way to cancel it on the printer, though that probably exists, and I couldn't cancel on the comptuer as it had already gone.)

I may play with it next week, but right now I'm in a grouchy mood. I wish it were simple like it was in Linux, but who knows what one might have to give up to get that--I've pontificated about that before, that sometimes ease of use starts making it difficult to do the important things. Maybe I should start a blog to grumble about things.

(I always feel SO much better after venting--thanks for listenin' guys. I probably won't play with this till next week now.)
Reply With Quote
Old 21st December 2014
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 jggimi View Post
PPDs can be useful to printing applications. They inform the application about printer capabilities, and can be very detailed. Mine includes all the possible pre-set paper sizes (413 plus custom), printable area, colorspace (RGB), built-in fonts (85), available RAM (73M) .....
Good point!
Reply With Quote
Old 21st December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 652
Default

Oh....kay. Well, I'm editing my previous post. I just went back to the beginning and it seems to work with the ps2pcl script of Warren's. So, I'm leaving it alone. I'm not sure what I overlooked when trying that before, maybe forgot to restart lpd, but I'll be happy with this. Looking around, it's surprisingly hard to see a listing of specs, especially for a discontinued printer, that explicitly states if it has postscript or not, the best I could find was that it did pcl6. Oh well, it works, so I'll take it as a win.

Again, thanks to Oko and everyone else who has contributed to this thread.
Reply With Quote
Old 22nd December 2014
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 scottro View Post
I could find was that it did pcl6.
That is probably what the printer actually can do. I found that even some printer which claim to be PostScript able default to Printer Command Language (PCL6 or 5)
Reply With Quote
Old 22nd December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 652
Default

Yeah, and I just realized, to my complete embarrassment, what happened last night--I am going to blame it on being tired.
As we all know the printcap file is really one long line, separated with backslashes--last night, I just blithely commented out what I was thinking of as a line--that is, I commented out the ps2pcl if line and thought the enscript one was working. It's embarrassing, but also funny, and who knows, this post might help someone avoid the same mistake, especially if they're new and don't realize what a \ in such a file would mean.

I also thought about playing with apsfilter and possibly the ppd that I was able to create on openprinting.org, but I can't see my needs requiring it, and am feeling lazy now that the oddness of the whole thing is solved. I figure the problems I was having may have been due to either not restarting lpd or blanking out and not realizing that commented lines weren't getting commented--I probably moved the order of the lines around and as it's one long line, probably changed from the working pf2pcl to the enscript one.

Last edited by scottro; 22nd December 2014 at 03:10 AM. Reason: typos
Reply With Quote
Old 22nd December 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

"Hear me, my son. You are not the first to be so wounded. Yea, uncounted thousands have come before thee, and uncounted thousands shall follow after."
Reply With Quote
Old 22nd December 2014
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 scottro View Post
I also thought about playing with apsfilter and possible the ppd that I was able to create on openprinting.org,
Apsfilter is just an ugly wrapper which is used to create command line arguments for Input Filter. It has not been updated upstream probably 10 years. Magicfilter is similar thing IIRC
I also see in FreeBSD ports enscript-letter and lprps. I am not familiar with those two. Actually I used to have two line home made filter for old LaserJet 4L which speaks PCL5. IIRC first line consisted of suppressing wake up garbage and the second one was essentially calling ghostscript with bunch of parameters. I stole idea from NetBSD documentation. I see that they update documentation and recommend broken foomatic-rip now
Reply With Quote
Old 22nd December 2014
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 652
Default

As I understood it in the reading I've done recently, enscript translates into postscript from ASCII. The description of lprps is that it is to be used with a postscript printer, which I think we've established is not what I have.

Yeah, looking at the apsfilter page, it does seem as if it's pretty ancient. Unless my printing needs change drastically, the setup I now have is fine.
Reply With Quote
Reply

Tags
cups, foomatic-rip, lpd, printcap, printing

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
lpd printing in Current shep OpenBSD Installation and Upgrading 4 20th December 2012 07:30 PM
unwanted printing - cracking? lumiwa FreeBSD Security 9 10th July 2012 01:28 PM
Printing. The final frontier. girarde OpenBSD General 11 5th January 2011 01:03 PM
Poster printing program map7 FreeBSD Ports and Packages 3 7th November 2010 07:41 PM
Problem with printing unicyclist OpenBSD General 8 1st May 2009 07:06 PM


All times are GMT. The time now is 04:57 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick