In this Guide we will cover how to make your network printer AirPrint compatible using a Raspberry Pi. This will allow you to print directly from your Apple iDevice to your existing non-airprint compatible printer. In this guide I will focus on the steps for a printer that is already networked. In our case a WiFi enabled Brother MFC printer. We will write another guide for USB printers.
You will need:
- Raspberry pi 3 wired to your LAN/network
- A SD card as the hard drive for your pi
- Raspbian Stretch with desktop installed on your SD card
To start off we need to update the software on the Raspberry Pi. Run the following command to check for updates.
sudo apt-get update
Now we need to ensure the kernel is current. Run the following command to check for updates to the kernel.
sudo apt-get upgrade
Now we need to install some new packages to enable the system to function as a CUPS server.
sudo apt-get install cups python-cups
Step 4 (Optional):
If you want to be able to print from windows devices install samba with the following command.
sudo apt-get install samba
Step 5 (Optional):
If you want a PDF printer run the following command.
sudo apt-get install cups-pdf
Step 6 (Optional):
If you have a HP printer get the HP printer drivers by running.
sudo apt-get install hplip
Now in the the browser on the Raspberry Pi desktop go to http://127.0.0.1:631
Click the Administration tab.
Click Add Printer.
Sign in with the username “pi” and the password “raspberry”.
Next, for most networked printers you will choose “AppSocket/HP JetDirect” & Click Continue.
Enter “socket://192.168.1.x:9100” where the IP is the IP address of your printer. 9100 is the standard port for networked printers.
Enter a Name for the printer, a Description, and a location note.
Make sure to check the “Share Printer” box during the setup. If you don’t do this you won’t see your printer.
Select the make of your printer. In my case I already installed the brother CUPS printer driver. This is why Brother in my list.
Choose your printer driver from the list and click “Add Printer”
Set the default printing options for your printer and click “Set Default Options”
Most likely you will need to change the Paper/Media Size from A4 to Letter.
You will now find yourself on the printers tab of the CUPS site. The setup is complete.
Install Bonjour for AirPrint
sudo apt-get install avahi-discover
Reboot the Raspberry Pi.
Step 18: Testing
If all has gone well you should now be able to open your iDevice and go to the icon of the box with the arrow pointing up.
Now select the printer Icon.
Next click the Select printer text in the printer options window.
Now you should be able to choose your printer from the list below.
If you don’t see your printer listed.
Confirm your printer is shared in the CUPS setup.
On my system after I would save settings changes to the CUPS admin, the CUPS service would not restart and I would get an error page. I ran the following command to restart CUPS.
sudo /etc/init.d/cups restart
How to restart avahi-discover.
sudo /etc/init.d/avahi-daemon restart
If you can’t login to the password prompt for CUPS, run the following command. This will add the user pi to the group of users that can admin CUPS. The default password for the “pi” user is “raspberry”.
sudo usermod -a -G lpadmin pi