Re: UNIX printing demystified

2020-10-24 Thread Mihai Popescu
I used CUPS every time since LPD is a confusing thing for me. I mean I was
never able to make it print. My Brother network printer shows this at
Protocol section:

Web Based Management (Web Server) HTTP Server Settings
SNMP Advanced Settings
LPD Advanced Settings
Raw Port
IPP HTTP Server Settings
AirPrint Advanced Settings HTTP Server Settings
Mopria
Web Services Advanced Settings HTTP Server Settings
Mobile printing for Windows
Google Cloud Print Advanced Settings
Proxy Advanced Settings
Network Scan
SMTP Advanced Settings
FTP Server
FTP Client
TFTP
mDNS Advanced Settings
LLMNR

Ironically I'm not able to say if it can accept PostScript or LPD or ...
too confusing. I tried /etc/examples/printcap with my settings filled in
from internet examples, it never worked. I tried your example here, it
doesn't like it.


Re: UNIX printing demystified

2020-10-24 Thread Christian Weisgerber
On 2020-10-24, Mihai Popescu  wrote:

> Is there a way to interface LPD directly with GUI apps like Chromium,
> mupdf, etc? I mean just to print from GUI menu Print.

Those print menus _should_ offer the option to print to lpr.  They
traditionally did.  If they don't now, then this is worth examining.
What GUI toolkit does the application use and what does this toolkit
do?

The GTK+ case is instructive.  Once upon a time, the GTK print menu
offered printing to lpr.  A number of years ago that disappeared.
Why?  Originally, GTK produced print output in PostScript.  The
assumption was that you could send this to any lpr printer, since
PostScript has effectively been the standard printer language in
Unix for decades.  The print menu changed, because GTK had switched
to producing print output in PDF.  The assumption was that random
lpr printers could not handle PDF, so the option of printing to lpr
was removed.  Fast-forward to the present.  Virtually all printers
that can handle PostScript also accept PDF directly and have been
able to do so for years.  Finally, two weeks ago (!) the GTK people
relented and have marked the lpr backend as capable of accepting
PDF.  This means that print-to-lpr is going to become available
again in GTK applications.  On OpenBSD that will most likely happen
with the next x11/gtk+3 update.

Are there still any GTK+2 applications with a print menu in the
ports tree?  Let me know, and I'll take a look at what's up there.

-- 
Christian "naddy" Weisgerber  na...@mips.inka.de



Re: UNIX printing demystified

2020-10-24 Thread Mihai Popescu
Is there a way to interface LPD directly with GUI apps like Chromium,
mupdf, etc? I mean just to print from GUI menu Print.


Re: UNIX printing demystified

2020-10-21 Thread Antoine Jacoutot
On Tue, Oct 20, 2020 at 10:10:30PM -0400, Predrag Punosevac wrote:
> 
> Every now and then people post a "question" about printing to this
> mailng list which exposes their confusion. I am putting this email
> together so that anybody capable of searching through the mailing list
> can at least have terminology straight before asking for help.
> Information presented here is in the public domain and I make no claims
> of posting anything new.
> 
> 
> Table of Contents:
> 
> 1. Print spooling overview: LPD, LPRng, CUPS
> 2. Common network printing protocols: LPD, IPP, JetDirect
> 3. Printer driver. 
> 4. Input filters
> 5. ASCII and page description language PostScript(PS)
> 6. PostScript Printer Description (PPD) files 
> 7. Printer recommendations
> 8. Code contribution
> 
> 
> 1. What is a print spooling? Why is needed?
> 
> A print spooler is a program/daemon that accepts print jobs from a
> program or network. It typically consist of two programs: a print
> spooler daemon that sends jobs to a printer and a command to submit
> print jobs to the spooler daemon. In general spooler is not needed on
> an operating system that allows a single user to perform only one task
> at a time as long as that single user doesn't try to send multiple
> documents to the printer at the same time.
> 
> However, UNIX has been designed multitasking, multiuser computer
> operating systems. Imagine that my wife and I send two documents to a
> printer at the same time. Her documents gets there first and gets
> printed. My document losses the race and my job is rejected because the
> device is busy. I wait a few minutes and I sent my document again but
> this time my daughter outrace me and her document get printed and not
> mine. Now imagine the organization with hundreds of users and only a few
> printers. This is exactly why we need a spooler program/daemon which
> will listen for the incoming printing requests, stores them in a spool
> queue, and then sends them to a printer when it becomes available.
> 
> The original Berkeley spooling system is The Line Printer Daemon
> protocol/Line Printer Remote protocol (or LPD) and it is available on
> any default OpenBSD installation. LPD is super simple and writing a lpd
> daemon should not be a too difficult for an undergraduate CS student.
> For those of us who are old enough to remember legendary Richard Stevens
> 
> https://www.oreilly.com/library/view/advanced-programming-in/9780321638014/ch21.html
> 
> As the computer technology and printing proliferated among common folks
> like me some system admins felt the need to develop more complex
> queueing policies. People start hitting limitations of LPD and
> eventually Dr. Patrick Powell felt compel to rewrite a new spooler
> program/daemon which will be more capable of complex printing policies
> and easier to incorporate drivers and input filters (please see below)
> so the UNIX world got
> 
> LPRng
> 
> http://web.mit.edu/ops/services/print/Attic/src/doc/LPRng-HOWTO.html#toc2
> 
> as the project grew and never became truly financially viable eventually
> was replaced with newer and super complex spooling system called CUPS
> 
> https://www.cups.org/documentation.html
> 
> Now the true CUPS claim to fame is the support for the new Internet
> printing protocol (IPP).
> 
> 
> 2. What are network printing protocols?
> 
> From its inception UNIX was designed to a distributed computing
> environment. A bunch of developers will use dumb terminals to connect to
> the same computer and do some work. At the same time it became possible
> for printers to be first class citizens on the LAN. LPD is not just a
> spooling system it is also a network protocol spoken by the daemon
> itself but also spoken by any decent quality printer. The major
> limitation of LPD that is primarily single direction protocol.
> 
> As printer became more sophisticated and more like a computers than
> microcontroller boards it became obvious that one could ask the printer
> about the level of the toner or the state of key mechanical components
> (drum comes to mind). Thus we got IPP. Actually, we got more than that.
> Most so called workgroup printers come with a built in CUPS server. 
> 
> That is not it. Manufacturer came up with many different network
> protocols. I will mention the one I use JetDirect. From wikipedia page:
> AppSocket, also known as Port 9100, RAW, JetDirect, or Windows TCPmon is
> a protocol that was developed by Tektronix. It is considered as 'the
> simplest, fastest, and generally the most reliable network protocol used
> for printers
> 
> 
> 3. What are the printer drivers? Do I need them.
> 
> In "old good times" all printers were capable of printing raw ASCII
> code. You don't need any drivers to print raw ASCII text on most
> business grade printers. As printers became more sophisticated users
> wanted to print more complicated things like pictures as oppose to ASCII
> art. One of earliest examples of page description language was 

UNIX printing demystified

2020-10-20 Thread Predrag Punosevac


Every now and then people post a "question" about printing to this
mailng list which exposes their confusion. I am putting this email
together so that anybody capable of searching through the mailing list
can at least have terminology straight before asking for help.
Information presented here is in the public domain and I make no claims
of posting anything new.


Table of Contents:

1. Print spooling overview: LPD, LPRng, CUPS
2. Common network printing protocols: LPD, IPP, JetDirect
3. Printer driver. 
4. Input filters
5. ASCII and page description language PostScript(PS)
6. PostScript Printer Description (PPD) files 
7. Printer recommendations
8. Code contribution


1. What is a print spooling? Why is needed?

A print spooler is a program/daemon that accepts print jobs from a
program or network. It typically consist of two programs: a print
spooler daemon that sends jobs to a printer and a command to submit
print jobs to the spooler daemon. In general spooler is not needed on
an operating system that allows a single user to perform only one task
at a time as long as that single user doesn't try to send multiple
documents to the printer at the same time.

However, UNIX has been designed multitasking, multiuser computer
operating systems. Imagine that my wife and I send two documents to a
printer at the same time. Her documents gets there first and gets
printed. My document losses the race and my job is rejected because the
device is busy. I wait a few minutes and I sent my document again but
this time my daughter outrace me and her document get printed and not
mine. Now imagine the organization with hundreds of users and only a few
printers. This is exactly why we need a spooler program/daemon which
will listen for the incoming printing requests, stores them in a spool
queue, and then sends them to a printer when it becomes available.

The original Berkeley spooling system is The Line Printer Daemon
protocol/Line Printer Remote protocol (or LPD) and it is available on
any default OpenBSD installation. LPD is super simple and writing a lpd
daemon should not be a too difficult for an undergraduate CS student.
For those of us who are old enough to remember legendary Richard Stevens

https://www.oreilly.com/library/view/advanced-programming-in/9780321638014/ch21.html

As the computer technology and printing proliferated among common folks
like me some system admins felt the need to develop more complex
queueing policies. People start hitting limitations of LPD and
eventually Dr. Patrick Powell felt compel to rewrite a new spooler
program/daemon which will be more capable of complex printing policies
and easier to incorporate drivers and input filters (please see below)
so the UNIX world got

LPRng

http://web.mit.edu/ops/services/print/Attic/src/doc/LPRng-HOWTO.html#toc2

as the project grew and never became truly financially viable eventually
was replaced with newer and super complex spooling system called CUPS

https://www.cups.org/documentation.html

Now the true CUPS claim to fame is the support for the new Internet
printing protocol (IPP).


2. What are network printing protocols?

>From its inception UNIX was designed to a distributed computing
environment. A bunch of developers will use dumb terminals to connect to
the same computer and do some work. At the same time it became possible
for printers to be first class citizens on the LAN. LPD is not just a
spooling system it is also a network protocol spoken by the daemon
itself but also spoken by any decent quality printer. The major
limitation of LPD that is primarily single direction protocol.

As printer became more sophisticated and more like a computers than
microcontroller boards it became obvious that one could ask the printer
about the level of the toner or the state of key mechanical components
(drum comes to mind). Thus we got IPP. Actually, we got more than that.
Most so called workgroup printers come with a built in CUPS server. 

That is not it. Manufacturer came up with many different network
protocols. I will mention the one I use JetDirect. From wikipedia page:
AppSocket, also known as Port 9100, RAW, JetDirect, or Windows TCPmon is
a protocol that was developed by Tektronix. It is considered as 'the
simplest, fastest, and generally the most reliable network protocol used
for printers


3. What are the printer drivers? Do I need them.

In "old good times" all printers were capable of printing raw ASCII
code. You don't need any drivers to print raw ASCII text on most
business grade printers. As printers became more sophisticated users
wanted to print more complicated things like pictures as oppose to ASCII
art. One of earliest examples of page description language was stack
language developed by Adobe called PostScript (to be discussed more
later in this document). A high quality (expensive in old times)
printers came with built in interpreters for PostScript language. You
don't need a driver to print on such printers. 

Then various