We have a Brother printer on our wireless LAN. All that I, personally, need from this printer is to print an occasional PDF file from my laptop. I run TCL 14 x86_64 on the laptop.
The full GNU/Linux printing stack (cups, avahi, cups-browsed, ghostscript, dbus, etc, etc, etc) looks to me like a giant, ugly hairball and I don't want to spoil the beautiful TCL minimalism just to print an occasional PDF. Therefore, I went in search of a tiny solution.
Since the printer supports IPP, in the end all I needed was to know the printer's URI and to have two small utilities (mutool and ipptool) somewhere in my PATH.
Here is the script I wrote for what I need, in case it is helpful to someone:
#!/bin/sh
# print-pdf v1.0
#
# Purpose: Print pdf file(s) to network printer as simply as possible
#
# Dependencies: mutool (included in mupdf.tcz) and ipptool (included in cups.tcz)
#
# Notes:
# * printer driver is not required
# * running cups is not required
# * all that's required is this:
# * you know the printer's url
# * you can ping the printer
# * printer supports ipp
# * you have mutool, ipptool, and this script in your PATH
#
# Usage: Arguments to script are absolute paths to pdf files to be printed
#
# Usage example:
# $ print-pdf $HOME/Documents/into_the_core.pdf
printer_uri="ipp://192.168.20.7:631/ipp/print"
# 1. create a disposable, generic .ipp file:
cat << EOF > /tmp/instructions-$$.ipp
{
VERSION 2.0
OPERATION Print-Job
REQUEST-ID 42
GROUP operation-attributes-tag
ATTR charset "attributes-charset" "utf-8"
ATTR naturalLanguage "attributes-natural-language" "en"
ATTR uri "printer-uri" "$printer_uri"
ATTR name "requesting-user-name" "tc"
ATTR mimeMediaType "document-format" "image/pwg-raster"
FILE "/tmp/print-me-$$.pwg"
}
EOF
# 2. create a .pwg file from each pdf given as an argument, then send it to the printer:
for fullpath in "$@"; do
mutool convert -o /tmp/print-me-$$.pwg "$fullpath"
ipptool -tv -f /tmp/print-me-$$.pwg "$printer_uri" /tmp/instructions-$$.ipp
rm /tmp/print-me-$$.pwg
done
# 3. remove the .ipp file:
rm /tmp/instructions-$$.ipp
A few more notes:
1. In my case, mutool is needed because my printer does not support pdf files directly. If yours does, then you can send pdf files to printer directly and can skip the mutool step and intermediary pwg file. You can find what your printer supports by using ipptool and sending it a "Get-Printer-Attributes" query. Do an internet search for how to do this, it's not hard.
2. mupdf.tcz in x86_64 repo does not currently include mutool, but it will soon
3. to get ipptool, you can either load cups (no need to start cups itself) or do what I did and extract just ipptool from cups.tcz and put it in your PATH. ipptool's dependencies are pretty minimal.