Printing at home from your Raspberry Pi

Yesterday I wrote about working from home with your Raspberry Pi, and talked about things like how to connect to your company VPN, and how to get video conferencing up and working. However, one thing I didn’t talk about – and that many of you have asked for some guidance on – was printing.

To get printing up and working on your Raspberry Pi the first thing you need to do is install CUPS. CUPS is an open source printing system developed by Apple that uses the Internet Printing Protocol (IPP) to support printing to both local and network printers.

Installing CUPS

Go ahead and open a terminal window, and install CUPS.

$ sudo apt-get install cups

CUPS has a lot of dependencies, so depending on your broadband connection installation, it could take a while. If you have any left in the house, now might be a good time for a cup of coffee ☕.

After installation you’ll need to give the pi user administrative rights on CUPS. To do this, go back to your console and type

$ sudo usermod -a -G lpadmin pi

to make the pi user part of the lpadmin group.

Adding a printer

Now open up your browser and navigate to https://localhost:631 . You’ll receive a security warning from your browser. Hit the ‘Advanced’ button and then ‘Proceed to localhost (unsafe)’.

Accepting the locally generated certificate

You’ll be presented with the CUPS interface. Click on ‘Administration’ in the top bar, and a drop-down will appear. Authorise yourself to CUPS as the pi user, which we’d added to the administrator group earlier.

Authorising yourself with CUPS as an administrator

After you authorise yourself, click on the ‘Add Printer’ button. CUPS will then look for locally connected (via USB) printers as well as any networked printers it can see on your home network.

For a lot of printers you’ll be presented with a number of possible options, as most modern printers offer a number of ways to connect. So depending on which printer you have, you might need to go through the process of adding a printer a couple of times to figure out the best method to connect.

Adding a printer in CUPS

I have a Brother HL-3140CW, an older model colour laser printer. While Brother offers Linux drivers, they are compiled for the x86 rather than ARM architecture, and the open source ‘brlaser’ driver doesn’t support my model. However, CUPS does list a ‘driverless’ option for communicating without a native printer driver using the Internet Printing Protocol (IPP).

Selecting a driver, I chose “IPP Everywhere”

Picking this option, I was presented with a list of drivers for the printer. I picked IPP Everywhere from the list, and hit the ‘Add Printer’ button.

Successfully added the printer

After a few seconds CUPS should present you with the ‘Printers’ tab, which should show you your connected printer. If everything is okay it should show that the printer is ‘Accepting Jobs’.

Testing the printer

Now we have our printer set up we need to test it. Go ahead and open LibreOffice Writer from the start menu, and enter some test text.

Writing a test document

Then click on ‘File > Print’ in the LibreOffice Writer menu.

Printing our test document from LibreOffice Writer

If everything has gone smoothly your printer should start making appropriate printing noises and should print your test document.

Our test documents

I actually went ahead and printed two test documents just to be sure colour printing was working okay, and happily it was working just fine!

Wrapping up

The exact process you’re going to go through to get your printer working will depend heavily on which printer you own. The trickiest bit is always going to be drivers. Thankfully, these days things are a lot easier than they used to be, as most printers – especially networked printers that live on your wireless network – offer standard ways to print and you don’t necessarily have to rely on a native (manufacturer-provided) driver any more.

23 comments
Jump to the comment form

Avatar

Very nice. Thanks for the post!

Reply to Harry Hardjono

Avatar

Great tutorial!! Worked perfect and the explanation/steps were extremely easy to follow. Worked the first time. And you are correct – CUPS takes a bit of time to load. Thanks.

Reply to David Clark

Avatar

Hmm, I thought that CUPS and IPP support had been installed in the 2020-02-13 full image. Seemingly not. Anyway, additionally installing cups-ipp-utils, system-config-printer and printer-driver-cups-pdf will not only give you a really nice printer config front-end under the Preferences menu, but also provides a handy Print-to-PDF virtual printer along with IPP support. Messing around with the terrible CUPS web front-end is something I don’t miss.

Reply to scruss

Avatar

Best advice on this page.
Thanks a lot!

Reply to CooliPi

Avatar

Great article, well presented and factual.

Reply to Derek White

Avatar

Really nice guide. How can we add email printing. So we could send email to RPI’s email and print the contents, like most wifi printers do nowadays

Reply to John

Avatar

Well done – as always. I’d like to make a remark, though. It seems to be quite a challenge to find a guide on printing with CUPS from a Raspberry Pi as a client on the internet. Maybe you would want to look into this as an addition.

Reply to thornston

Avatar

can not login as administrator, ??

Reply to Qompaqniet

Avatar

Read that part again! CUPS won’t allow root logons, too easy to trash the whole system I guess. Log on as a regular user who is in the lpadmin group.

Reply to Kevin Bowers

Avatar

Thank you, this is something I just couldn’t get to work when I tried it in the past.

Reply to Paul Nielson

Avatar

Thank you for share the info! I’ve tried with my Brother HL-1212 but i couldn’t find my model. My RaspberryPi4 recognize the printer but doesn’t appear the model in the list. What can i do? Thanks!

Reply to Emiliano

Avatar

If you have an Epson printer, and you have problems printing or scanning, try the Epson ESC/P-R driver. Go to Preferences, Add/Remove Software and search for “ESC/P-R”. Check it and hit OK to install. Then, in CUPS, use the ESC/P-R driver.

Reply to Joel

Avatar

Neat. I actually did this on my Pi Zero W last year but with tinylinux. very fast to boot which is really ideal for truly wireless setup. sadly I scrapped it halfway due to lack of scanner function. my printer has a scanner that is very useful for the whole home to access it, at least the printing is perfect from Windows to CUPS

there’s another driver that handle scanner but it’s really complex to set up for network use. my target is to be able to print and scan regardless of client OS.

Reply to haziq

Avatar

Thanks for this, it got me part of the way, my printer wasn’t on the list of available printers but managed to find some help on the forum to add hp drivers.
Anyway, this is welcome addition on a very difficult topic for a beginner like myself.

Reply to Paul

Avatar

Sorry for being rude with my first comment. I could not get trough that step.
Albeit, very happy now at this moment it is working. The Pi with all the advantages is well working and the home office is will be continued in the future. All for as it seems now for about 75% p/w. Even the VPN is perfectly working.
Thanks

Reply to Qompaqniet

Avatar

In previous years few manufacturers provided linux drivers for their printers (with HP and Lexmark (formerly IBM) being notable exceptions). Hopefully that has changed, but don’t count on it – especially if wanting to use an old model printer you have lying around at home.

If you already have a printer do try it … but if you’re going out to a buy a printer do your research first starting with the comprehensive database at http://www.openprinting.org/printers

Reply to Don Burch

Avatar

How can we add email printing ?

Reply to Jenelle

Avatar

I have set up printers per your instructions it shows in CUPS it printed but nothing comes out of the printer. It seems like a gate is still closed. I am using a USB connected Brother MFC-7420 and a HP CP1025nw (wireless) and I can’t get either to print even though CUPS shows jobs have gone through as shown below.

ID Name User Size Pages State Control
Hewlett-Packard_HP_LaserJet_CP1025nw-13 Unknown Withheld 1k 1 completed at
Thu May 7 17:12:33 2020
Hewlett-Packard_HP_LaserJet_CP1025nw-15 Unknown Withheld 9k 1 completed at
Thu May 7 17:16:02 2020

Reply to Jerry West

Avatar

Hi
I have installed cups and then added my printer. It found it no problem, however the driver doesn’t work properly. It works okay for Black and White, but if you use colour it puts each of the colours on diferent lines. IE black, Cyan, Magenta, yellow. Looks quite funky especially on photos. I tried looking into the driver, but found nobiody else with this issue. I tried from a windows PC printer works fine.
I thought okay lets get a new printer this one is fairly old. So I started looking for new Epson printers however not one of the new printers I found had drivers in cups. So I researched further as to what recommendations there were going back as far as 2016. Two of the suggestions were use Brother or HP as generally you will find drivers. So I started by looking into HP LIP seemed promising so installed HPLIP however found out the latest version available for armhf is 3.18.12. I then went looking for any printers available upto this version. No joy could not find a recent printer available in that list or older one. Looked into later versions of the HPLIP and found a couple of printers that might work, but they were above £300, but with a max budget of £150 or less not much help. I continued looking, but can seem to find no drivers for RPI with latest Raspbian for any current printers.
My conclusion from all this is printing in Linux specifically with RPI and latest RASPBIAN is an absolute mindfield and having spent over a week looking at this trying to find a current ink jet printer, I still have had no luck. I do have another old Epson, but there is no driver for that. While searching I keep finding that current printers are difficult. There appears to be other methods like driverless, but no difinitive guide that is current for current printers. As has been said here already “few manufacturers provided linux drivers” that is even worse for ARMHF. I have not done much with regard scanning, but that appears to be a mindfield at first glance. An RPI in depth article on printing and scanning would be very welcome. Even better would be getting a manufacture to help with this by providing armhf drivers with all new printers. Just looking at the number of pi’s out there that’s a fair amount of sales they would benefit from. Having the latest version of HPLIP working on ARMHF would be another possibility.
Many Thanks
Mike
As always my views on RPI and all the amazing work you all do is absolutely fantastic.

Reply to Michael P

Avatar

I forgot to add its a USB printer I have and was also looking for.

Reply to Michael P

Avatar

For Canon Printers:
Printer Setup On Raspberry Pi

$ sudo apt-get install cups
$ sudo usermod -a -G lpadmin pi
$ sudo apt-get install cups-backend-bjnp
$ sudo service cups restart

browse to https://localhost:631
Advanced->Proceed

(Bookmark)

Administration->Add Printer
sign in pi:xxxxx (pi password for the machine)

Click on Discovered Network Printers: Canon_MX860
Continue
Continue
Model: Canon MX860 series – CUPS+Gutenprint v5.2.11 (en)
Add Printer
Change Default Options: Duplex Print-LongEdge
Click Set Default Options
Click Administration->Set As Server Default

Printers->Maintenance->Print Test Page !!!

Get printer status:

$ lpstat -p -d

[email protected]:~/Carl/Examples/imu/di_BNO055 $ lpstat -p -d
printer Canon_MX860_series is idle. enabled since Sun 17 May 2020 09:55:22 AM EDT
system default destination: Canon_MX860_series

Print a file:

$ lp resetIMU.py

Reply to Alan

Avatar

Very grateful for the main article and for this essential addition re Canon. Thank you.

Reply to Jim

Avatar

Thank you. The installation for my HP printer (internet connected) was straightforward and easy :)

Reply to Aubrey Rudman

Leave a Comment