My wife currently uses a Rollo Thermal Printer for shipping labels. We have been extremely happy with this printer however she prefers to print these shipping labels from her android phone. For the last couple of years, we have been happily using Google's Cloud Print service to accomplish this. Google intends to retire Cloud Print in December 2020 so to keep the wife happy, I need to come up with an alternative.
Rollo provides an RPi print driver and I have a couple of spare Raspberry Pi's floating around so I decided to try and create my own wireless print server. For the initial setup of the RPi you can refer to my article Installing Raspberry Pi OS Lite No Monitor Needed
Here goes.
RPi Setup
The first thing we need besides an RPi and a Rollo Printer is a software called CUPS. According to cups.org, "CUPS is the standards-based, open-source printing system developed by Apple Inc. for macOS® and other UNIX®-like operating systems". CUPS uses the Internet Printing Protocol (IPP) to "serve" printers to other network devices.
Installing CUPS on the RPi is pretty straight forward.
First, you need to open a terminal on your RPi. This can be either remotely as done in my article Installing Raspberry Pi OS Lite or directly via a connected Keyboard and Monitor.
Next let's ensure that our Raspberry Pi OS is fully up to date.
sudo apt update
then
sudo apt upgrade
This can take some time so be patient.
Once this is complete install CUPS
sudo apt install cups
This can also take some time so be patient and/or find something else to do for a bit.
Next, you will need to ensure that our username has administrative privileges to CUPS. If you left your RPi username as the default pi, then the following command will accomplish this goal. If you are using a different username then substitute your username for 'pi'.
sudo usermod -a -G lpadmin pi
Rollo Driver
Once that is done we need to install the Rollo print driver. The print driver is located at https://www.rollo.com/driver-linux/
wget https://www.rollo.com/driver-dl/beta/rollo-driver-raspberrypi-beta.zip
unzip rollo-driver-raspberrypi-beta.zip
sudo sh install.run
The end product should look like this. If you have any error messages, now would be the time to troubleshoot prior to moving forward.
CUPS
Next lets set CUPS to allow us to administer remotely
sudo cupsctl --remote-admin --remote-any --share-printers
sudo /etc/init.d/cups restart
Now we can connect to CUPS on our RPi via a web-browser. Make sure your Rollo Printer is connected via USB to your RPi at this time.
CUPS runs on port 631 by default. If you left the RPi hostname as the default of raspberrypi then you can browse to http://raspberrypi.local:631/.
If you changed the RPi hostname you will need to substitute your hostname or the RPi IP address with raspberrypi above.
You will get a security message in your browser when you first open the CUPS webpage as we have not set up SSL. DOn't worry about this just continue.
Click Administration in the menu, then click add printer.
If you get an error message stating "forbidden" at this time, in your ssh session re-run the following then refresh the webpage.
sudo usermod -a -G lpadmin pi
sudo /etc/init.d/cups restart
If your Rollo printer is connected to Your RPi it should appear under 'Local Printers'.
Select your Rollo Printer and click 'continue'. Give your Rollo Printer a name, description, and location. Make certain to enable Share This Printer then click 'Continue'.
Now you will need to select the appropriate driver. If you followed the previous instructions properly you should see Rollo in the available list. Select Rollo and click 'Continue'.
Make sure to select the newly added printer and click 'Add Printer'
Click 'Set Defaults' then print a test page.
If everything went well your Rollo printer just printed a test page directly from CUPS.
To print from Android we need to have an SSL certificate. Going back to our terminal
sudo openssl req -new -x509 / -keyout /etc/cups/ssl/server.key / -out /etc/cups/ssl/server.crt -days 3650 -nodes
Now we need to edit out cupsd.conf file to use our newly created certificate.
sudo nano /etc/cups/cupsd.conf
Add the following 2 lines then ctrl+x to exit.
ServerCertificate /etc/cups/ssl/server.crt
ServerKey /etc/cups/ssl/server.key
Then restart the CUPS server
sudo /etc/init.d/cups restart
Print from Android
To print from Android, first, we will need to install the Android CUPS Printer app from the Google Play Store
You don't need to do anything with this app, just make sure it's installed.
Next, from your android phone browse to the Rollo sample shipping label.
https://www.rollo.com/sample/
Click on the ellipsis in the top right of your browser and click print.
Click the printer drop-down at the top of the screen and click 'All Printers'. Android with CUPS Printing installed should automatically locate your printer. Select the Rollo Printer and ensure you have the correct page size selected.
Click the print button and we are done!!!
**** Update 6-11-2022 ****
Some users have reported that a library (libcupsimage2) may be missing after following this method. If you recieve errors regarding "filter failed", please run
sudo apt install libcupsimage2
Issue was identified and resolved by BlindAssassin111 at https://forums.raspberrypi.com/viewtopic.php?t=331359
Update 12/28/2020
I swapped the Pi 2 for a Pi Zero W and have not experienced any issues. Thanks VILROS for the fast shipping!
To accomplish this without having to set everything up again, log in to the original Pi via ssh
sudo apt update
sudo apt upgrade
Once you are fully updated just take the SD Card from the original Pi and use it in the Pi Zero W.