>> Am 05.04.2009 um 19:44 schrieb ropers: >> > I'm looking for a colour laser printer...
2009/4/5 STeve Andre' <and...@msu.edu>: > > Seems that this might make a good faq entry, if it isn't already there(?). OpenBSD printing in general? It's not currently in the FAQ as such. I gotta admit here that I've previously not paid a lot of attention to the details of how printing is implemented on OpenBSD (and Unix-like OSes in general). Up to now, I mostly just tinkered around, relying on existing X desktop environments to do the right thing for me, probably via CUPS, without me really having a thorough understanding of what went on behind the scenes. I am trying to catch up on that, though I'm finding that comprehensive, thorough, and up-to-date documentation on the whole Unix printing landscape seems to be somewhat hard to find. Here's what I'm currently looking at: - http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/printing.html - http://www.freebsd.org/doc/en/books/corp-net-guide/index.html - http://www.onlamp.com/pub/a/bsd/2004/07/08/FreeBSD_Basics.html - man: lpc (8) line printer control program lpd (8) line printer spooler daemon lpr (1) off line print lprm (1) remove jobs from the line printer spooling queue lptest (1) generate lineprinter ripple pattern pr (1) print files printcap (5) printer capability database ulpt (4) USB printer support (did I overlook any?) I haven't looked for CUPS documentation yet, because I want to understand the older lp system first (also, correct me if I'm mistaken, but I think CUPS depends on lp?). Despite my reading of the above stuff, I'm not actually in a position to write an OpenBSD printing FAQ submission, because I don't understand things well enough yet, and the only thing worse than no information is wrong information. But I can describe what I think I know here, and maybe this is useful to someone else -- just don't mistake it for reliable, factual documentation: 1- The lpd/lpr system establishes a spooler and protocol to send print jobs to the printer. If you're talking the right language, it's possible to talk to the printer directly, bypassing lpd/lpr, but this is discouraged. 2- Lpd/lpr is the traditional Unix way of doing these things, but it's not the only game in town. Parts of SMB --that are also implemented by SaMBa, and hence available in OpenBSD-land-- also implement spooling and a printing protocol. 3- There also are further third party spool/print protocol systems that can do the same thing, but they're not very common. 4- Some printers contain their own embedded servers which may provide not just a browser-based configuration interface, but also offer options such as document upload via HTTP or other protocols (even FTP). This allows the user to just upload the document they want to print to the printer's very own embedded server, and the printer then picks up the document and prints it and (hopefully) deletes it. This of course requires that the document be in a format that the printer can understand, e.g. PDF or PS. 5- Finally, similar to the way it's possible to talk to a locally attached printer directly it's also possible to talk to a network-attached printer directly, via TCP/IP, again bypassing lpd or Samba et al. Okay, so that's how one can talk to printers in general. But that's just one step, albeit a crucial one. Depending on the type of printer it may additionally be required to install a printer driver, and/or convert the document to be printed into a format the printer can understand. I don't yet understand how and at what stage printer drivers come in with OpenBSD, particularly drivers for USB-attached non-PostScript inkjets and the like. Presumably a mere (CUPS-)PPD or printcap file isn't enough? If anyone can point me to good information on this or even explain, that would be more than welcome. I find that this part is frequently conveniently skipped in Unix printing documentation on the Web, but I'd love to know. What I do broadly understand is the different document conversions required: There are basically six different types of printers (but many printers are compatible with several of these modes): I. plain old line printers (admittedly, true daisy wheel/IBM typeball character impact printers are rare these days, and technically today's printers mostly work as raster image printers, but they do still accept ASCII input like most line printers did); II. PostScript printers; III. raster image printers (AFAIK their protocols are mostly proprietary?); IV. printers that work with other proprietary or open protocols and page description languages that aren't raster image printing and aren't PostScript (e.g. PCL); V. printers that are "smart" and --as mentioned above-- include an embedded file server, allowing you do just upload e.g. PDFs instead of worrying about running a print server; these printers will do all that for you, including the queueing/spooling; VI. "winprinters"/printers that are "dumb" and depend on the computer they're attached to to have a driver installed that will do everything and tell it in baby steps to now squirt out some ink, now move the print head, etc.; these printers probably wouldn't even understand ASCII on their own, nevermind PostScript. What with the above plus the choice between SMB and lpd/lpr or others, we have two major protocols (and possibly others) and a whole selection of printing languages. Combine these, and you end up with a dizzying amount of possible combinations, all just so we can print a friggin' document. Let's look at some of the possible conversions: - If you want to print an old-school ASCII file and the printer understands ASCII, then it's possible to just send the raw ASCII data to it and witness it magically being committed to paper. - If you want to print an ASCII file but the printer understands PostScript and *only* PostScript, it's necessary to use groff(1)/troff(1) or an ascii2ps program or similar to convert the raw ASCII data to PostScript first. - If you want to print other text or image data to a PostScript printer, that data too needs to be converted to PostScript. - On the other hand, if you have PostScript data and want to print that to a non-PostScript raster image printer, you need to involve ghostscript, which can convert a PostScript file to a rasterized image, which is then handed off to the raster image printer's driver somehow. - If you have a raster image printer that doesn't grok ASCII, the printer driver would presumably take care of a conversion there as well. - In case you only have a line printer, or only ASCII mode is supported due to lack of open documentation/drivers: Raster images and advanced PostScript formatting or images and drawings are not normally converted to ASCII. Conversion into ASCII art is possible, but serious applications of ASCII art have almost all disappeared. If written PostScript documents are converted to ASCII advanced formatting is normally stripped, leaving just plain text. - And of course PostScript data should ideally print on PostScript printers without further ado, and with the right drivers, raster image data should print on raster image printers without too much trouble. Should. This concludes this braindump during this learning process. If anyone can offer more insight, particularly OS-specific ones into the world of printing and printer drivers on OpenBSD, or if this inspires someone more competent than me to get serious about churning out a printing section for the OpenBSD FAQ, then that'd be more than welcome (& this humble mail is public domain). Thanks and regards, --ropers