sidetone

Daemon

Reaction score: 713
Messages: 1,557

Postscript (PS) and PCL (Printer Command Language) are printer languages known as Page Description Languages (PDLs) supported by the majority of printers for interpreting and printing jobs. These two PDLs are alternate models developed by Adobe and HP respectively. ASCII is a printer language which PCL is an extension of. PJL is another type of printer language for controlling features. Win(dos) or GDI printers are generally incompatible with BSD's or Linux. Printers that let the software from the computer run them completely are referred to as dumb printers.

Many programs simply output data as Postscript. A filter is often needed for different types of output formats (separate from the printer language), even when the printer understands the same printer language as a program's output (such as Postscript). Output formats that need to be converted to a printer language include: dvi, Fortran and Raster.

LPD (Printer Daemon) also known as LPR is the default with FreeBSD. LPRng and CUPS are successors to this legacy protocol, which have their own implementations of LPD included. These three programs use and can alter printcap(5). LPR and LPRng are both described by RFC 1179 (not as a standard). LPD and CUPS daemons can be enabled through rc.conf.

CUPS and Ghostscript are separate methods that make PCL printers usable from Postscript output. Ghostscript can be used with LPR (LPD) or LPRng.

Devices
For printer devices: ulpt and unlpt are for USB, sio and cuau are for serial, cuaU is for serial connected by USB, and ppc and lpt are for parallel ports. These can be viewed with dmesg.

IPP
IPP (Internet Printing Protocol) defined by RFC 2910 and RFC 2911 uses port 631. This protocol has more advanced features than LPD. IPPS is the secure form for connections through SSL. IPP is open for future compatibility with 3D printers, fax and scanner use.

LPD (LPR)
LPR requires manual set up through custom shell scripts of filters to convert plain text or other types of data, even between Postscript outputs to Postscript able printers. print/a2ps can simplify this task of converting ASCII to Postscript output. print/apsfilter is a tool to simplify printcap configuration for LPR.

LPRng
LPRng (LPR Next Generation) is an advanced replacement for LPR, and is an alternative to CUPS. It is under the GPL and Artistic licenses. IFHP determines the format and does conversions, including by use of Ghostscript. LPRng takes care of format conversions through its filters, and of Postscript output through Ghostscript. LPRng was designed to be more secure than LPR.

CUPS
CUPS provides uniform printer drivers for BSD's, Mac OSX and Linux. PPD (Postscript Printer Description) are drivers available in CUPS that convert Postscript to a format that specific models of non-Postscript printers can read. This framework supports more printers than LPR. PCL printers are supported under CUPS. CUPS is under the Apache license.

IPP is the default protocol that CUPS uses. In addition to IPP, CUPS also has protocol support for: LPD, SMB (Server Message Block) and HP Direct Jet. CUPS through IPP can be accessed by http:// 127.0.0.1:631. This framework shouldn't be addressed remotely through CUPS as buffer overflows can expose root. Passwords are also transferred unencrypted.

print/cups-fxlinuxprint is a CUPS driver for Fuji/Xerox printers. print/cups-splix is a CUPS driver for printers that use the Samsung Printer Language (SPL), including some Xerox models. Other CUPS drivers or PPD's for specific printers: print/min12xxw, print/dymo-cups-drivers and print/okc321.

Ghostscript
Ghostscript (under AGPL) can convert Postscript outputs to printer languages which specific non-Postscript printers can interpret. In addition to PCL, Ghostscript makes ESC printers functional. LPR can be set up to make use of Ghostscript. LPRng includes Ghostscript for printer language conversion too.

GhostViewer (print/gv) is a program for viewing Postscript output on the screen.

Alternate printing methods
LibreOffice and Apache Open Office likely provide their own drivers, so printing from here likely has to be set up independently, from an already working LPR or CUPS set up. OpenOffice which is now succeeded by these two programs worked this way. It's worth looking into if default printer options can be changed in LibreOffice.

Gimp uses Gutenprint (formerly Gimp-Print) for its plugin and drivers. Gutenprint is made for use with CUPS and Ghostscript. There's the possibility that additional setting up is required from an already working set up that prints from other programs.

Epson uses ESC as its printer language: print/epson-inkjet-printer-escpr. For Brother laser printers that don't support PCL or Postscript there's print/brlaser. print/foo2zjs is for Minolta (and XQX) printers that use Raster. I'm unsure of the functioning status of these drivers in ports.

HPLIP drivers haven't been mentioned so far. Samba is an advanced topic that also hasn't been addressed here.

References:
* FreeBSD 6 Unleashed (out of date, but still has relevance)
* Network Administration with FreeBSD 7
* linuxjournal.com/article/6729
* etutorials.org/Linux+systems/red+hat+linux+bible+fedora+enterprise+edition/Part+IV+Red+Hat+Linux+Network+and+Server+Setup/Chapter+17+Setting+Up+a+Print+Server/Choosing+CUPS+or+LPRng+Print+Services/
* cups.org
* lprng.com
* pw.org/ipp
* other documentation

Further reading
http://www.wonkity.com/~wblock/docs/html/lpdprinting.html

 

Snurg

Daemon

Reaction score: 577
Messages: 1,349

Great write-up, thank you very much!
Maybe a hint to LibreOffice using its own printer drivers would also help users avoid headaches.
Because, not everybody thinks in the first place about exporting their LibreOffice documents to PDF just to be able to print them, when LibreOffice claims it cannot connect to printer [eg. not directly, but via Cups].

And I remember some guy (iirc olli@ ) has written a nice post/article about how to configure LPR to work and cooperate with GUI applications. (When I find that post again, I'll link it here)
 

jb_fvwm2

Daemon

Reaction score: 204
Messages: 1,786

There is also the port "enscript" [ 3 or four flavors ] which can produce postscript files from text files, which can be piped, to a printer device in /dev with
one of the ghostcript flavors, which works on some printers.
 
OP
sidetone

sidetone

Daemon

Reaction score: 713
Messages: 1,557

Maybe a hint to LibreOffice using its own printer drivers would also help users avoid headaches.
It's lightly mentioned here, but it may not have been detailed enough or it was easy to gloss over.

It was documented in FreeBSD 6 Unleashed that OpenOffice used its own drivers, so it didn't work with an already set up LPR driver or Ghostscript software. This likely hasn't changed for LibreOffice or Apache OpenOffice, and is likely also true for CUPS drivers. Printing is said to currently not work on LibreOffice, so this likely still applies. It's possible that this isn't the issue, but it could be a left over problem from the differences in how OpenOffice used printing drivers.

Here's more specificity from that thread,
I seem unable to get printing via Cups work... I am unable to print, getting the error "cannot connect to printer" from LibreOffice and other programs.
Mysteriously libre Office often fails in printing while printing pdf is okay.
OpenOffice then (now either LibreOffice or Apache Open Office) offered its own drivers. So printing from it wouldn't work with the typical LPR drivers or Ghostscript software already set up on a FreeBSD system for Postscript output. Likely it's the same for CUPS (which takes care of more printers than LPR), or whatever other driver is set up as the default on FreeBSD.
Printing in LibreOffice worked in Linux according to that thread. On FreeBSD, converting a LibreOffice document to PDF and printing it from another program worked.

There's a possibility that to some extent this also applies to GIMP. Or Gutenprint may have to be set up independently than a CUPS or LPR driver. Gutenprint is for use with CUPS, Ghostscript and GIMP.
 
OP
sidetone

sidetone

Daemon

Reaction score: 713
Messages: 1,557

HPLIP
HP Linux Imaging & Printing (print/hplip) contains PPD drivers and configuration utilities for HP printers to be used with CUPS and for HP scanners. HPLIP has over 3,000 PPD's which covers most HP Printers.

Foomatic
Foomatic is GPL software for PPD files, spoolers and filters. It can generate PPD files.

About configuring CUPS and LPRng
CUPS (Common Unix Printing System) is available with print/cups. For setting up and configuring CUPS, see: https://docs.freebsd.org/en/articles/cups/. CUPS installs alternate files of lpr under /usr/local/ directories.

LPRng is found at sysutils/LPRng. It uses printcap, lpd.conf, and lpd.perms for configuration. LPRng conflicts with CUPS installations.

Spool
The spool holds printing jobs to be printed in order. Print jobs are held in the /var/spool directory.

Filters
Filters are useful for different types of output. Carriage returns are different for command line output from Bourne shells, MS DOS, text files and Postscript output. Without the right filters, printers can stair-step or text can otherwise be misaligned.

Services
rc.conf:
Code:
lpd_enable="YES"
cupsd_enable="YES"
#
lprng_enable="YES"
lprng requires that lpd and cupsd be disabled.

service can also be used to start services without rebooting. If lpr isn't enabled, there will be an error message when attempting to print.

grep -i print /etc/services
Code:
#         35/tcp       any private printer server
#         35/udp       any private printer server
npp       92/tcp       #Network Printing Protocol
npp       92/udp       #Network Printing Protocol
print-srv 170/tcp      #Network PostScript
print-srv 170/udp      #Network PostScript
printer   515/tcp      spooler
printer   515/udp      spooler
ipp       631/tcp      ipps    #IPP (Internet Printing Protocol)
ipp       631/udp      ipps    #IPP (Internet Printing Protocol)
JetDirect:
Code:
jetdirect   9100/tcp   #HP JetDirect card
LPR uses port 515. Local network printers that use LPD (LPR) can be directly addressed on port 9100.
 
Last edited:
OP
sidetone

sidetone

Daemon

Reaction score: 713
Messages: 1,557

PAPPL
PAPPL is a printer driver framework that is complementary to CUPS libraries for use on IPP (Internet Printing Protocol). This project was founded by the same founder of CUPS, after leaving that project. PAPPL is under Apache License Version 2.0 (with the exception of linking to GPL libraries).

Through USB and network printing, PAPPL supports: JPEG, PNG, PWG Raster, Apple Raster and raw data.

Intended uses for PAPPL: label printing, 3D printing, scanning, faxing, printer compatibility, Gutenprint compatible applications. lprint is a PAPPL application for label printing by the same author.

PAPPL library requirements:
* ZLIB, CUPS, LIBUSB
* For authentication and security: LIBPAM, GNUTLS
* For graphics: LIBPNG, JPEGLIB
* For Zeroconf: Avahi (Mac OS uses Bonjour)

Repository: https://github.com/michaelrsweet/pappl/releases/tag/v1.0.0

OpenPrinting
Postscript Printer Application (ps-printer-ap) by OpenPrinting is to support Postscript printers for use with PAPPL on IPP. It is for use with libraries and filters of: libcupsfilters and libppd. A lot of these printer specific files are compressed, and other drivers and filters can simply be added on. This project is a derivative of hp-printer-ap. ps-printer-ap is under the Apache 2.0 License, with the exception for linking to GPL libraries.

OpenPrinting maintains CUPS official repository as of March 2021, from what was previously a fork of Apple's offering.

Sun has a printing API implementation in ports, which is operated by OpenPrinting: print/openprinting.

OpenPrinting is an organization under the Linux Foundation.

PWG
Printer Working Group (PWG) contributed to IPP standards specifically for: scanning, facsimile and 3D printing. IPP Everywhere and IPP 3D are PWG standards.

IPP Everywhere is designed to allow printing without requiring vendor-specific software.

IPP 3D is a standard for 3D printing that identifies 3 file formats: 3MF (3D Manufacturing File Format), PDF, and PWG Safe-G-Code Subset for 3D Printing.

IPP specifications
The current standard for the IPP model is RFC 8011. The proposed standard for its url scheme is RFC 3510.

About security considerations for IPP:
 
Last edited:
OP
sidetone

sidetone

Daemon

Reaction score: 713
Messages: 1,557

PAPPL is supposed to be the replacement for cups , am I wrong?
You're close. PAPPL requires CUPS libraries for drivers.

PAPPL is for standardizing developing printer drivers. It seems a lot remains the same of using Postscript as the dominant PDL, and using conversions around this language to and from other Printer Device Languages. CUPS was centered around using PPD's for translating printer languages around Postscript.

PAPPL, like CUPS, is also centered around IPP.

The quote is a little obscure, but CUPS or its libraries is remaining with PAPPL.
 
OP
sidetone

sidetone

Daemon

Reaction score: 713
Messages: 1,557

Print and file sharing

SMB
SMB (Server Message Block) is a protocol for file and printer sharing that can be used between FreeBSD, Windows and Linux. It was introduced by IBM, and later developed heavily by Windows. For using SMB: CIFS (Common Internet File System) is an implementation for Windows, and Samba is an implementation for Unix-like operating systems. Samba can deliver printing jobs to an operating system's native printing driver or to CUPS.

Samba is configured through /usr/local/etc/smb.conf. printcap and spooling files can be configured here. Printing is addressed in smb.conf mostly under the [printer] section or share, but other configurations for printing are outside of this section.

SWAT is the Samba Web Administration Tool that provides an IP interface for configuring smb.conf. SWAT is accessed on port 901: for instance, with the web address, http:// 10.0.1.10:901. Detailed configuration requires manually editing smb.conf.

SMB uses NetBIOS (Network Basic Input/Output System) by default, which is limited to a single LAN. It had capability to be used with IPX and lesser known network protocols, instead. For communication with Windows, SMB requires NetBIOS as the network protocol.

NFS
NFS (Network File System) was developed by Sun for file sharing on UNIX-like operating systems. Setting up printer sharing on NFS is a scarce topic. NFS isn't native for Windows operating systems.

AFS; Mac OS
Some Macintosh OS computers can access SMB through CIFS, and can access NFS. AppleShare File Server (AFS) was Mac's native file sharing application. net/netatalk can be used on FreeBSD for AFS capability.

CUPS
Basics about Common Unix Printing System (CUPS) for printer sharing have been previously addressed. Allowing CUPS to be used outside a LAN without a VPN, or even outside of localhost exposes security vulnerabilities. CUPS is accessed through localhost on the IPP port of 631.

Zeroconf
PAPPL and CUPS which use the IPP protocol, can be compiled with Zeroconf to ease printer networking. The Avahi library option is available for Zeroconf on FreeBSD. On MacOS, Bonjour is used, not Avahi. Bonjour, Avahi and Openmdns are different implementations of Zeroconf, which eases network configuration.

net/mDNSResponder is FreeBSD's port of Bonjour. net/avahi-libdns is a library for the Linux implementation of Zeroconf. These two implementations are comparable in size, while overall, Avahi pulls in a lot of dependencies. The OpenBSD implementation of Zeroconf is the lightweight net/openmdns. Openmdns, Avahi and mDNSResponder conflict in the ports tree.

Zeroconf consists of: MDNS (Multi-DNS) described by RFC 6762, DNS-SD (DNS-Service Discovery) described by RFC 6763, and link-local addressing.

IANA services
Network and printer related sharing services listed in /etc/services:
Code:
swat           901/tcp    # samba web configuration tool
nfsd           2049/sctp  nfs        # NFS server daemon
nfsd           2049/tcp   nfs        # NFS server daemon
nfsd           2049/udp   nfs        # NFS server daemon
lockd          4045/udp   # NFS lock daemon/manager
nfsrdma        20049/tcp  #Network File System (NFS) over RDMA
nfsrdma        20049/udp  #Network File System (NFS) over RDMA
nfsrdma        20049/sctp #Network File System (NFS) over RDMA
netbios-ns     137/tcp       #NETBIOS Name Service
netbios-ns     137/udp       #NETBIOS Name Service
netbios-dgm    138/tcp       #NETBIOS Datagram Service
netbios-dgm    138/udp       #NETBIOS Datagram Service
netbios-ssn    139/tcp       #NETBIOS Session Service
netbios-ssn    139/udp       #NETBIOS Session Service
ipp            631/tcp       ipps    #IPP (Internet Printing Protocol)
ipp            631/udp       ipps    #IPP (Internet Printing Protocol)

Refs:
Further reading
 
Last edited:
OP
sidetone

sidetone

Daemon

Reaction score: 713
Messages: 1,557

CUPS configuration
Common UNIX Printing System can be installed as print/cups.

/usr/local/etc/cups/cups-files.conf sets locations for default files. Locations of printcap and lpd can be set here. This is important to choose subdirectories from either /usr/local/ or /usr/ when two versions of printer files exist on a computer.

Add your user to the cups group, through /etc/group.

To set up the device, see devfs.rules(5). An example from https://docs.freebsd.org/en/articles/cups/:
Code:
[system=10]
add path 'unlpt*' mode 0660 group cups
add path 'ulpt*' mode 0660 group cups
add path 'lpt*' mode 0660 group cups
add path 'usb/X.Y.Z' mode 0660 group cups
Use service devfs onerestart, for this to take effect.

The labeled section has to be addressed from /etc/rc.conf:
Code:
devfs_system_ruleset="system"

In order for cups to be available on http://localhost:631 (http://127.0.0.1:631), the cupsd service must be enabled. Set the cupsd daemon through /etc/rc.conf or /etc/rc.conf.local: cupsd_enable="YES". Then, use service cupsd onestart to immediately enable it, or service cupsd onerestart to restart it after making changes. Make sure that localhost isn't blocked by your firewall. lpd can optionally be enabled alongside cupsd with: lpd_enable="YES" and using service lpd start (or restart). LPD service may only be needed, if you're using a custom printcap file with the default location set to /etc/printcap, instead of the printcap file that comes with cups at /usr/local/etc/printcap.

CUPS conflicts with the sysutils/LPRng port. cupsd and lpd services are also incompatible with enabling lprng.

For changing the default host, /usr/local/etc/cups/client.conf is obsolete. While IPP (through IPPS) allows encryption capability, CUPS which uses it, doesn't have this secure transport. cupsd.conf(5) has hostname and SSL configuration options. cupsd.conf can be altered through the CUPS interface.

On the localhost interface, log in to CUPS by using your FreeBSD user account that has cupsd permissions. In admin, for adding printer, your printer should show up.

print/cups-filters may be required for the CUPS interface to send print jobs. After installing this, the cupsd service needs to be restarted.

Zeroconf is only needed if your printer isn't connected locally, but is connected on a network. This just simplifies IP allocation.

CUPS drivers
There are a few generic printer drivers, based on make or type, to choose from, when adding your printer through the CUPS interface. Basic generic selections are available here, including: PCL laserjet, HP PCL Deskjet, Epson 9-pin, Epson 24-pin, text only, raw, Xerox and Postscript.

In ports, there are additional drivers pertaining to specific makes of printers. Installing ports listed below, and reloading the CUPS webpage adds a large selection of printer drivers that can be chosen from.

These ports add more selections of drivers to choose from on the CUPS interface: print/brlaser, print/cups-fxlinuxprint, print/epson-inkjet-printer-escpr
, print/foo2zjs, print/foomatic-db, print/hplip, print/okc321, print/splix, print/dymo-cups-drivers, and print/gutenprint.

print/ghostscript7, print/ghostscript8, and print/ghostscript9 contain many of the same overlapping drivers that can also be added to the CUPS interface.

print/epson-inkjet-printer-201601w brings in a linux-base emulator. print/min12xxw is a driver that isn't picked up by CUPS.

CUPS, LPD and Postscript
LPD in base, and CUPS from ports perform the same function of receiving Postscript output and sending it to Postscript capable printers. CUPS allows printers that use other PCL's to be used through Postscript via PPD conversions. Ghostscript is a substitution for PCL printers to work as if they were Postscript. According to The Complete FreeBSD (2006), LPD is or was able to output to non-Postscript printers by using Ghostscript through printcap with gs as an input filter. I'm uncertain if another filter would apply for Gutenprint to work this way.

Ghostscript offers a few conversion programs between Postscript and pdf files. It also offers gv, which allows potential printer output to be seen on the monitor.

More about Postscript
Postscript is the default for both CUPS and Apple. Conversions for other printers rely on PPD's, Ghostscript and perhaps Gutenprint. For the most common PDL's: Postscript is considered higher quality than PCL, so more preference is centered around it. There are also very high quality printers that don't use either of these two PDL's.

Postscript printers cost more because of hardware and font license fees from Adobe. However, this company offers Postscript software drivers for free. (Opensource driver software is available as mentioned a few times.) HP computers that have M in the model for Macintosh are Postscript printers (one may want to confirm that the specifications say Postscript).

Printers
Printer labeling lists its specs, often: supported PDLs, fonts and graphics formats.

ESC/P (Epson's developed PDL) printers are used in consumer inkjet printers, as well as dot matrix, receipt, thermal, labeling and barcode printers.

References/Further reading
 
Last edited:
Top