# About Printing on FreeBSD



## sidetone (Mar 23, 2021)

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









						Chapter 10. Printing
					

This chapter covers the printing system in FreeBSD




					docs.freebsd.org


----------



## tuxador (Mar 24, 2021)

PAPPL is the potential cups replacement . It uses ippeverywhere for printers that support theses feature.


----------



## Snurg (Mar 24, 2021)

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 (Mar 24, 2021)

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.


----------



## sidetone (Mar 24, 2021)

Snurg said:


> 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,


Snurg said:


> 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.





tuxador said:


> Mysteriously libre Office often fails in printing while printing pdf is okay.





sidetone said:


> 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._


----------



## sidetone (Mar 24, 2021)

*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:

```
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`

```
#         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:

```
jetdirect   9100/tcp   #HP JetDirect card
```
LPR uses port 515. Local network printers that use LPD (LPR) can be directly addressed on port 9100.


----------



## sidetone (Mar 24, 2021)

*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:

https://www.zdnet.com/article/80000-printers-are-exposing-their-ipp-port-online/
https://www.shadowserver.org/news/open-ipp-report-exposed-printer-devices-on-the-internet/


----------



## tuxador (Mar 25, 2021)

PAPPL is supposed to be the replacement for cups , am I wrong?


----------



## SirDice (Mar 25, 2021)

tuxador said:


> PAPPL is supposed to be the replacement for cups , am I wrong?


You're wrong.



> PAPPL is a simple C-based framework/library for *developing CUPS Printer Applications*, which are the recommended replacement for printer drivers.








						PAPPL
					






					www.msweet.org


----------



## sidetone (Mar 25, 2021)

tuxador said:


> 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.


----------



## sidetone (Mar 26, 2021)

*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. dns/mdnsd is BSD developer's Zeroconf implementation. 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. Thread what-is-zeroconf.79651

*IANA services*
Network and printer related sharing services listed in /etc/services:

```
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:*

https://www.samba.org/~ab/output/htmldocs/Samba3-HOWTO/index.html
http://netatalk.sourceforge.net/
samba.org
Network Administration with FreeBSD 7
FreeBSD 6: Unleashed
Zero Configuration Networking: The Definite Guide
*Further reading*

http://wiki.samba.org
https://vermaden.wordpress.com/2018/12/27/smb-cifs-on-freebsd/


----------



## sidetone (Mar 29, 2021)

*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/:

```
[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:

```
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 on MacOS (perhaps not obsolete on FreeBSD and other operating systems). 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*

https://www.informit.com/articles/article.aspx?p=167786
The Complete FreeBSD (2006)
https://docs.freebsd.org/en/articles/cups/


----------



## sidetone (Jun 13, 2021)

Here is a refined version of this, about printing on FreeBSD, without setup instructions for CUPS or LPR: http://freebsdwiki.net/index.php/Printing,_about

For more setup instructions:





						Documentation - CUPS.org
					






					www.cups.org
				




Edits:

OpenOffice output to LPR using its own drivers, in place of Ghostscript. It's likely that LibreOffice and Apache OpenOffice work like this too.
It may have been remote administration, not remote printing that may have been unsecure through earlier versions of CUPS. CUPS encryption and SSL may have been added since then. Printing from outside a LAN may require a CA certificate for security. Whatever the situation with CUPS was, Samba has always allowed secure printer sharing through CUPS.
CUPS can be used on the text console including through configuration files in a way that resembles LPD, but is purely CUPS and can reference IPP.
The author of CUPS also had a book out about this printing application: https://www.msweet.org/books.html


----------



## Alain De Vos (Jun 13, 2021)

foomatic-filters can not be used together with cups-filters.
Bye the way, how do you use the /etc/services file. What is it good for how do you use it. Is there a watchdog for the entries ?


----------



## sidetone (Jun 14, 2021)

`grep -i [entry/number] /etc/services` tells you the port number of a service. IANA is the maintainer of those entries, and their website has a more complete list.

In few cases, the port number can be entered into the end of an http address, like when typing http://localhost:631 to access CUPS which 631 is for IPP.

The most common use for these numbers is for setting up firewall settings, like in pf.conf, for instance.

I'm unsure if I oversimplified about Foomatic on there, by forgetting to omit it from inclusion with other filters on CUPS. It's for use on LPR as a filter on FreeBSD. It may of had to be separated from the mention of other filters to apply to CUPS. Foomatic is a Linuxism, so perhaps works with CUPS on Linux. print/cups-filters and print/foomatic-filters do conflict with each other.


----------



## sidetone (Jun 20, 2021)

*Modern printing: CUPS over IPP*
CUPS can be administered on the command line, through the web interface, and through a GUI. This print architecture uses Apache License 2.0. Legacy versions were under GPL.

CUPS supports encryption for administration and printing, which wasn't available in older versions. Kerberos will be replaced by OAuth and PAM for access control and security by CUPS 3.0.

Samba is only needed for printing on LANs that include Windows computers.

CUPS will remain compatible with Zeroconf.

*Driver status*
PDF, PWG Raster, and JPEG are modern formats used as replacements for PDL's. Nearly all printers manufactured in the last decade support IPP, and PWG Raster ('image/pwg-raster') and JPEG ('image/jpeg') formats. About half as many support the PDF ('application/pdf') printing format. Commercial and industrial printers which are a minority still support legacy print drivers.

Airprint is a driver technology for printing from Apple MacOS and i-products. Apple Raster ('image/urf') is the format supported by Airprint. Adobe, Conexant Systems and Qualcomm Technologies are affiliated with Apple's Airprint technology.

Mopria is a technology for printing from Android devices. PAPPL may be needed for Mopria functionality on future CUPS versions.

Postscript ('application/postscript') and PCL ('application/vnd.hp-pcl') are legacy formats, which will no longer be supported in CUPS 3.0. IPP Everywhere compliant printers will be used. PPD's are being depreciated, and will be fully removed by CUPS 3.0. CUPS 3.0 will no longer have driver support. CUPS 2.4 will still support legacy drivers, as well as new printer functionality. How will older printers still be used with CUPS 3.0? Perhaps through PAPPL?

'application/octet-stream' tells capable printers to detect which format to use. For printers that don't have this capability, the format type needs to be specified in configuration or when printing.

'text/plain' is a format supported by simple printers.

The Wi-Fi alliance has a printer specification.

*Command-line*
On the command line, CUPS uses BSD lpr style commands.

The command `cupsctl` can adjust settings in cupsd.conf.

More about using CUPS through the command line:

https://hub.packtpub.com/monitoring-cups-part1/
https://hub.packtpub.com/cups-how-manage-multiple-printers/
https://www.informit.com/articles/article.aspx?p=27354

*Configuration files*
The server configuration file from CUPS admin edits: cupsd.conf. The web interface can be turned on and off also through cupsd.conf.

*Using CUPS on IPPS over https*
Recent versions of CUPS have encryption, unlike older versions. I followed the instructions from here: https://www.cups.org/doc/encryption.html.

All within the /usr/local/etc/cups/ directory.

cupsd.conf(5) is for the print server:

```
DefaultEncryption Required
Encryption Always
SSLOptions MinTLS1.1
SSLPort 631
```

client.conf(5) is for the client to use CUPS over https:

```
AllowAnyRoot No
AllowExpiredCerts No
Encryption Required
SSLOptions MinTLS1.1
TrustOnFirstUse No
ValidateCerts Yes
```

cups-files.conf(5) is for important locations:

```
ServerKeychain /usr/local/etc/cups/ssl
```

The web-address, https://localhost:631/admin works, although it says it's insecure and uses a self-signed certificate. http isn't blocked from use.

CUPS needs to be built with GNUTLS and be restarted for https to work. When the printer administration page is accessed through https, a key is added to the ssl directory.

*CUPS logs*
/var/log/cups/

*References*

https://www.cups.org/doc/encryption.html
https://www.cups.org/blog/2018-06-06-demystifying-cups-development.html
https://ftp.pwg.org/pub/pwg/liaison/openprinting/presentations/cups-plenary-may-2021.pdf
https://www.msweet.org/pappl/
https://mopria.org/


----------



## decuser (Jun 21, 2021)

sidetone said:


> Postscript ('application/postscript') and PCL ('application/vnd.hp-pcl') are legacy formats, which will no longer be supported in CUPS 3.0. IPP Everywhere compliant printers will be used. PPD's are being depreciated, and will be fully removed by CUPS 3.0. CUPS 3.0 will no longer have driver support. CUPS 2.4 will still support legacy drivers, as well as new printer functionality. How will older printers still be used with CUPS 3.0? Perhaps through PAPPL?


Wow. This sounds horrifying and/or cool, jury's out. Horrifying in the sense that I had one heck of a time figuring out how to print with my Brother MFC-8670DN back in the day and have had it working flawlessly for nearly a decade without any config changes. Cool in the sense that progress is being made? I use an ipp url now, does this mean in the future that I won't have to specify my PPD?


----------



## sidetone (Jun 21, 2021)

Most printers after 2010 are compatible with the new CUPS printing method.

CUPS 2.3 works with both traditional drivers and the new method. CUPS 2.4 will also work this way. If your printer supports the new methods, PPD can be skipped now.

It's the future CUPS 3.0, where the old method of PPD, PCL and PostScript will no longer be used. I'm unsure how older printers will be supported, or if their use will simply be generic. It's a future release, so the details may not be figured out yet.

In the PWG/CUPS plenary in an above link, PPD distribution was described as a distribution and security nightmare.

For printers that definitely support it, this is good. For old printers, there's a question of compatibility. Hopefully, they will function with it.

There's a need for label printers, legacy printers and industrial printers to work with it, but I don't know if there's an answer for this.

LPrint, https://www.msweet.org/lprint/, is intended for label printers to print on CUPS, with a few already supported. The replacement on CUPS 3.0 for legacy and other printers without modern or current mainstream formats may be the PAPPL framework, https://www.msweet.org/pappl/, which allows the conversion of legacy drivers to the current print application.

3D file formats for IPP include: 3MF, U3D, PRC and PWG G-code. https://www.pwg.org/3d/index.html

*IPP Scan*
PWG intends to offer driverless IPP scanning, similarly to CUPS functionality for newer printers. However, there are currently no scanners with IPP capability. SANE and its drivers are still the de-facto standard for scanning. https://openprinting.github.io/upcoming-technologies/02-ipp-scan/


----------



## sidetone (Sep 8, 2021)

*Netcat Printing*
BSDNow: Netcat printing (episode 416) - August 19, 2021

Starting at 19:00 until 21:16 this episode reads with a few errors, https://retrohacker.substack.com/p/bye-cups-printing-with-netcat.

The examples given were of printing txt and pdf files through netcat:

```
nc netlaser 9100 < sample.txt
nc 192.168.1.226 9100 < file.pdf
```
This capability with netcat is for newer printers that directly accept txt, pdf and other specific formats. Not discussed in the article nor podcast is printing filters for netcat. For some printers or file types, I suspected the possibility that filters are needed with netcat. The author of this article confirms in the comments, that for printers, including older ones, without direct filetype support, an output must be piped to a filter before sending it to netcat. In the case of pdf, that filter is gs.

It's not clarified if the printer must be capable of using port 9100. Perhaps printing systems that used port 9100 had file-type support sooner than common printers did.

After the reading of the article, the podcast continues by discussing printing until 24:26. It talks about basic history and past experiences from LPR to CUPS.


The ability to print with netcat over port 9100 has been at least documented 10 years ago in http://www.wonkity.com/~wblock/docs/html/lpdprinting.html.


----------



## scottro (Sep 8, 2021)

That's one reason I really hate videos when the basics can be gotten from taking 10 seconds to read text. Of course, in most cases (not BSDNow), they gotta have their clicks on youtube.

Using netcat directly with pdf doesn't work with my Samsung C460, but doing pdf2ps file.pdf file.ps and sending file.ps through netcat works.  (But pdf2ps is just a shell script using gs, which I actually never realized till I saw your post and looked.)


----------



## sidetone (Sep 8, 2021)

The information is scattered throughout this page, as I researched and wrote, I learned more, then got a better idea about printing. Writing this page cleared up a lot of conceptions about printing, and it hasn't been put together like this anywhere else.

I saw that netcat article a while ago, but couldn't make sense of it then. Looking at the netcat article again after being a topic of the BSDNow podcast, helped me piece that part together with what I learned before by writing this. The comment of that article by the author helped confirm what I suspected. scottro's comment also helps confirm, and also shows that it depends on the printer's capabilities.

Up until recent posts, everything on here was organized at, http://freebsdwiki.net/index.php/Printing,_about. It uses the FreeBSD Documentation License, so it can be taken and added on to.


*CUPS GUI*
Administering CUPS through IP address of the printer on a network, and command line through file configuration and LPR-like commands were already covered.

print/system-config-printer offers the CUPS administration GUI through Gtk2. It's originally from Fedora, but it goes to show, that CUPS can also be administered through a GUI, because its API allows it. This GUI interface isn't often used. I tried running this program on my FreeBSD system, and it didn't start up. This wouldn't be the preferred method anyway.

Screenshots of print/system-config-printer are at, https://mwiki.static.linuxfound.org/images/8/8b/System-config-printer.pdf.

https://www.linuxquestions.org/questions/linux-software-2/gui-for-cups-4175494163/
https://docs.oracle.com/cd/E26502_01/html/E29012/gjlcy.html


----------



## Geezer (Sep 9, 2021)

sidetone said:


> print/system-config-printer offers the CUPS administration GUI through Gtk2. It's originally from Fedora, but it goes to show, that CUPS can also be administered through a GUI, because its API allows it. This GUI interface isn't often used. I tried running this program on my FreeBSD system, and it didn't start up.


Yes, I like that. Integrates managing the printer in a DE. xfce 4.16 13.0-RELEASE-p4


----------

