Will's avatar

⬅️ See more posts

Improved home printing

20 December 2024 (5 minute read)

🔮 This post is also available via Gemini.

technology

Who still owns a printer, anyway?

For some reason, I have a printer at home. I think I bought it for printing wet signature-requiring legal documents a few years back, and buying a printer was cheaper/easier than getting things remotely printed and posted back to me. It’s a cheap-ish Brother greyscale laser printer.

Whatever the reason, since having the printer I have become immensely popular with my family, as it turns out that no one else near us has one. Despite no one else owning one, it also turns out that people do need to use them from time to time – e.g. for printing out shipping labels, gift voucher codes for birthday cards, ID document scans for certification, etc.

When someone comes over to my house to print something, it’s always a bit of a faff. It’s a network printer that’s discoverable and usable via Bonjour on a Mac, which is great, but no-one ever seems to have the needed drivers (specific to my printer) installed in order to actually do the print. This results in me trying to dig around for the exact printer model number, help the person search for the needed drivers, download and install them, and then continue with the print. The process invariably includes them asking, “what is a driver?” – a word now seemingly lost to the ages.

The same is often even true for myself; I have a number of computing devices at home and I can never remember which has the needed drivers installed.

I was keen to find a way to ease this process both for myself and the other people who need to make use of it.

Sharing a printer around the home

I’d used CUPS in the past to help manage printers on specific workstations, and wondered if I could use this program to also “share” a printer resource more flexibly around the home. Those who follow my blog will know that I run a small “homelab” consisting of a bunch of always-on Raspberry Pis for various purposes. I was sure I could combine CUPS and a Pi into a working print-sharing system.

I’m certain my set-up is child’s play to anyone who works in system administration in any capacity, but my mini project resulted in a very useful outcome for me, at least. Below I document my steps and the results.

I chose one of the Pis (running Manjaro Linux) to be the print host. On this, I installed CUPS (pacman -S cups).

I needed to configure the CUPS daemon so that I could access the admin interface from my Mac (since my Pis are headless), and a few other niceties. To do so, I edited /etc/cups/cupsd.conf and added/changed some lines near the top:

Listen 0.0.0.0:631
Listen /run/cups/cups.sock
Browsing Yes
BrowseLocalProtocols dnssd
DefaultAuthType Basic
WebInterface Yes
IdleExitTimeout 60
ServerName teldrassil
<Location />
  Order allow,deny
  Allow all
</Location>
<Location /admin>
  AuthType Basic
  Require valid-user
  Allow all
  Order allow,deny
</Location>

# ... Rest of the config

Tweak this as needed. In particular, the topmost Listen line allows the web interface to be accessible remotely, the ServerName line allows for specifying a name for the CUPS server, and the <Location> blocks allow remote access to the specific needed pages on the web interface. Most of the file I left un-changed from the defaults.

Once happy, start and enable the CUPS service with Systemd: systemctl start cups and systemctl enable cups.

Next, I needed to find the driver for the printer, which the CUPS system would use to print on the user’s behalf. My exact model number is the Brother HL-1210W, and after some digging I found a website which could provide the needed PostScript printer driver (PPD file). I downloaded it and saved it for later.

With driver in-hand, the next step was to configure the printer on CUPS. I did this via the web interface by navigating to http://<Pi Host>:631/admin, and clicking “Add Printer”. CUPS was able to discover the printer automatically, and so I selected the discovered version (it had a Line Printer Daemon URL like lpd://STRING/BINARY_P1). I added the relevant details and, on the driver selection page, uploaded the PPD I’d downloaded earlier.

The printer was now set-up and available in CUPS and, more importantly, could print! To print the “test page” via the CUPS web interface (to verify it was working) I needed to install also the ghostscript package on the Pi (pacman -S ghostscript). At this point, also double-check that “Share printers” and “Allow printing from the internet” are selected on the admin page.

Finally, to share the printer, I installed Avahi. This package allows other machines on the network to discover the CUPS printer: pacman -S avahi (avahi-daemon also needs to be started/enabled via Systemd).

What’s the outcome?

Within a few seconds, I saw the new printer pop up in my Mac’s “Add Printer” dialog. I could add it with the generic driver and print to it right away without problems.

macOS “Add Printer” dialog showing the printer

The printer also came up on the “Print” dialog on my iPhone, allowing me to print mail and files without needing any extra software.

iOS “Print” dialog showing the printer

A short project, but a useful evening spent. The next time someone pops round to print something I can let them get on with it themselves.

✉️ You can reply to this post via email.

📲 Subscribe to updates

If you would like to read more posts like this, then you can subscribe via RSS.