- Регистрация
- 17 Февраль 2018
- Сообщения
- 25 396
- Лучшие ответы
- 0
- Баллы
- 2 093
Offline
A lot of raw materials and energy are used to produce a printer. The longer the device is in use, the better in terms of sustainability.
With a Raspberry Pi, you can indirectly make older printers network-compatible and also enable printing via a wireless network using a smartphone, for example.
What requirements apply
The printer should at least have a USB interface so that it can work with a Raspberry Pi.
It also makes sense to find out on the internet whether there are current Linux drivers for the printer. If the device works smoothly on a Linux desktop system, it will also work perfectly in the new constellation.
When choosing the Raspberry Pi, it may also be an older model.
Model 5 is used in this article.
The following instruction assumes that you have already installed the operating system (in our case Raspberry OS) on the Raspberry Pi and that you are connected to the internet or local network.
All work is carried out on the console, which is called up via SSH from another computer. If a monitor and keyboard are connected to the Raspberry, you can also carry out the commands in the terminal on the desktop.
Setting up the print server on the Pi
Before you can set up the printers, you need to customize the Cups configuration file.
IDG
The Cups printer system is required as a basis. This should have been installed automatically by the operating system. Try with
sudo apt install cups
to install it. If the system reports back that you already have the latest version, everything is fine. In the first step, assign the standard user the right to make changes to the printer system. If you have not changed anything, this is the “pi” account. If you have stored other users, adjust the command accordingly.
sudo usermod -a -G lpadmin pi
This user must log in later if they want to make changes to the printing system via the browser (e.g. add a new printer).
Now some manual work is required. You need to customize the Cups configuration file. This looks slightly different depending on the operating system. The file is located under /etc/cups/cupsd.conf. Look for an entry with “Listen localhost:631” and precede the line with a “#” to comment it out. Instead, insert the line “Port 631”.
This should already be standard in newer versions of the operating system.
Then look for the instruction “WebInterface”. There should be a subsequent “yes”. If this is not the case, correct this to “WebInterface ”. An entry beginning with “Browsing ” can be seen near the port specification.
Further reading: 10 surprisingly practical Raspberry Pi projects anybody can do
Here you add a line with
BrowseAddress @ LOCAL
This allows other systems to recognize the printers that are connected to the Pi. You will then find prohibitions regarding access to individual directories. These each begin with “”.
Add an “Allow @LOCAL” to each of these sections. Then save the file. You must confirm the changes to the printer system by restarting with
sudo service cups restart
to communicate the changes.
Adding a printer
To be able to access the setup of a printer as an admin, the standard user you have set up must log in with a password.
Raspberry Pi
This completes the preparations. All further configuration work can be carried out via a browser on any computer in the local network. There, call up the IP address of the Raspberry Pi and add port 631 (which you defined in the configuration), i.e. “http://192.168.178.183:631” in total.
Cups should now welcome you with its start page. Now connect the desired printer to the Raspberry Pi via USB and switch it on so that the system can recognize it.
Then select “Administration” from the navigation bar and click on “Add printer.” The system will now redirect you to the “/admin” subpage. There, click on “Add printer” again. If the device is supported by Cups, the printer should already appear under “Local printers.” Click on the model and then on “Next.”
Raspberry Pi
In the following dialog, several fields are waiting for input or confirmation. These are the name of the printer, as it will also appear later under Windows, a description, and optionally a location.
Activate the option to share the printer in the network. Only then can it also become a network printer. In the next dialogue, select the manufacturer, accept it, and select the appropriate model from the list.
If the exact model name is not available, try a model that is as close as possible to the actual model. Confirm the details. The printer will now be added.
Printers under Linux and Windows
Providing the connected printer as a network component does not solve the problem that there must be drivers for the device for all client operating systems that are to use the printer.
This looks good for Linux insofar as the printer can be set up on the Raspberry under Cups. The way to set up the printers connected to the Pi differs between the distributions.
Under Ubuntu, it is best to enter “printer” in the search field. Click on the result and “Add printer” to go to the page of available printers. If the share does not yet appear here, click on the “Add printer” button.
Select the model and click “Add.” The search for a suitable driver begins. This is usually successful and no further steps are necessary. The driver is installed and added to the list of known devices.
If there are any problems here, click on the cogwheel in the list of printers and then on “Printer details.” You can repeat the search for drivers in the following dialog.
If you have a PPD file for the device, this can be uploaded using the button of the same name. Alternatively, you can search the internal database of drivers sorted by manufacturer and search for the model there.
To ensure that the accessing computers can handle paper formats, color definitions, or special options, you must also set up the appropriate driver locally.
IDG
In Windows, enter “Printer” in the search field of the Start menu to find the shortcut for setting up the printer. Then click on “Add device” in the following dialogue.
Windows not only queries the local interfaces, but also searches the network for shared printers.
Wait a moment until the list is complete. Then press “Add device” next to the desired device. Now you have to wait a moment until the OS has synchronized the printer with its driver database and established a connection to the device.
In the event of an error, the same applies as with Linux. You will need to search the internet to see if there is a special Windows driver for the model. With laser or inkjet printers that can process the usual paper formats, manual intervention is rarely necessary today.
Printers under Mac OS and Airprint
Thanks to Cups and Raspberry, the original software also accepts the label printer on the Mac via the network.
IDG
On the Mac, go to System Preferences and then to the “Printers & Scanners” section.
In the following dialog, click on the plus sign on the left-hand side to add a printer. As the necessary Apple protocol was also installed during the installation of Cups in the current versions of the Raspberry OS, the printer should be found with the name used under Cups.
Now you need to tell Mac OS which driver you want to use. To do this, click on “Select software” under “Use.” In the following list, decide on the desired model.
Apple has also remained true to itself with regard to printers and has developed its own protocol for wireless printing with Airprint. It is based on the “Bonjour” service that has been around for years.
In order for a printer connected to the Raspberry Pi to be used as a “network printer” via Airprint, the “Avahi Daemon” must be running on the system.
Depending on the version of the OS used on the Pi, this must be installed manually via the package management.
In the current version, this is already done thanks to the installation of Cups.
If you have an iPad or iPhone in your home, you can easily check the correct setup by using the share function in an app and then selecting “Print.” You should then be able to select the printer there.
Example scenario with Label Writer
A Dymo Label Writer has been working reliably at the author’s workplace for some time — albeit connected directly to a local computer.
Other members of the household have not yet had access to it. Thanks to programs such as Lprint, the device is supported by all operating systems.
With Raspberry, Cups, and the latest drivers, this is now changing. To be able to access all models when setting up under Cups, first install a package with additional drivers from the manufacturer. This is generally good advice for printers from all manufacturers.
Using
apt install printer-driver-dymo
the package is loaded (with PPD files), installed, and integrated into Cups. Once this preparatory step has been completed, we set up the new printer as described above. Layouts, label selection, and thus communication with the printer are then handled by the application software.
The printer should then be available as soon as you have set it up on a client. Unless the program uses its own proprietary approach. For special printers, you will have to search for a PPD file manually, as different paper and media formats are used.
Without a PPD file, the printer can probably be addressed and the printout may also start. However, the result may then be that an A4 test page is reduced in size so that it fits on an address label.
With a Raspberry Pi, you can indirectly make older printers network-compatible and also enable printing via a wireless network using a smartphone, for example.
What requirements apply
The printer should at least have a USB interface so that it can work with a Raspberry Pi.
It also makes sense to find out on the internet whether there are current Linux drivers for the printer. If the device works smoothly on a Linux desktop system, it will also work perfectly in the new constellation.
When choosing the Raspberry Pi, it may also be an older model.
Model 5 is used in this article.
The following instruction assumes that you have already installed the operating system (in our case Raspberry OS) on the Raspberry Pi and that you are connected to the internet or local network.
All work is carried out on the console, which is called up via SSH from another computer. If a monitor and keyboard are connected to the Raspberry, you can also carry out the commands in the terminal on the desktop.
Setting up the print server on the Pi
Before you can set up the printers, you need to customize the Cups configuration file.
IDG
The Cups printer system is required as a basis. This should have been installed automatically by the operating system. Try with
sudo apt install cups
to install it. If the system reports back that you already have the latest version, everything is fine. In the first step, assign the standard user the right to make changes to the printer system. If you have not changed anything, this is the “pi” account. If you have stored other users, adjust the command accordingly.
sudo usermod -a -G lpadmin pi
This user must log in later if they want to make changes to the printing system via the browser (e.g. add a new printer).
Now some manual work is required. You need to customize the Cups configuration file. This looks slightly different depending on the operating system. The file is located under /etc/cups/cupsd.conf. Look for an entry with “Listen localhost:631” and precede the line with a “#” to comment it out. Instead, insert the line “Port 631”.
This should already be standard in newer versions of the operating system.
Then look for the instruction “WebInterface”. There should be a subsequent “yes”. If this is not the case, correct this to “WebInterface ”. An entry beginning with “Browsing ” can be seen near the port specification.
Further reading: 10 surprisingly practical Raspberry Pi projects anybody can do
Here you add a line with
BrowseAddress @ LOCAL
This allows other systems to recognize the printers that are connected to the Pi. You will then find prohibitions regarding access to individual directories. These each begin with “”.
Add an “Allow @LOCAL” to each of these sections. Then save the file. You must confirm the changes to the printer system by restarting with
sudo service cups restart
to communicate the changes.
Adding a printer
To be able to access the setup of a printer as an admin, the standard user you have set up must log in with a password.
Raspberry Pi
This completes the preparations. All further configuration work can be carried out via a browser on any computer in the local network. There, call up the IP address of the Raspberry Pi and add port 631 (which you defined in the configuration), i.e. “http://192.168.178.183:631” in total.
Cups should now welcome you with its start page. Now connect the desired printer to the Raspberry Pi via USB and switch it on so that the system can recognize it.
Then select “Administration” from the navigation bar and click on “Add printer.” The system will now redirect you to the “/admin” subpage. There, click on “Add printer” again. If the device is supported by Cups, the printer should already appear under “Local printers.” Click on the model and then on “Next.”
Raspberry Pi
In the following dialog, several fields are waiting for input or confirmation. These are the name of the printer, as it will also appear later under Windows, a description, and optionally a location.
Activate the option to share the printer in the network. Only then can it also become a network printer. In the next dialogue, select the manufacturer, accept it, and select the appropriate model from the list.
If the exact model name is not available, try a model that is as close as possible to the actual model. Confirm the details. The printer will now be added.
Printers under Linux and Windows
Providing the connected printer as a network component does not solve the problem that there must be drivers for the device for all client operating systems that are to use the printer.
This looks good for Linux insofar as the printer can be set up on the Raspberry under Cups. The way to set up the printers connected to the Pi differs between the distributions.
Under Ubuntu, it is best to enter “printer” in the search field. Click on the result and “Add printer” to go to the page of available printers. If the share does not yet appear here, click on the “Add printer” button.
Select the model and click “Add.” The search for a suitable driver begins. This is usually successful and no further steps are necessary. The driver is installed and added to the list of known devices.
If there are any problems here, click on the cogwheel in the list of printers and then on “Printer details.” You can repeat the search for drivers in the following dialog.
If you have a PPD file for the device, this can be uploaded using the button of the same name. Alternatively, you can search the internal database of drivers sorted by manufacturer and search for the model there.
To ensure that the accessing computers can handle paper formats, color definitions, or special options, you must also set up the appropriate driver locally.
IDG
In Windows, enter “Printer” in the search field of the Start menu to find the shortcut for setting up the printer. Then click on “Add device” in the following dialogue.
Windows not only queries the local interfaces, but also searches the network for shared printers.
Wait a moment until the list is complete. Then press “Add device” next to the desired device. Now you have to wait a moment until the OS has synchronized the printer with its driver database and established a connection to the device.
In the event of an error, the same applies as with Linux. You will need to search the internet to see if there is a special Windows driver for the model. With laser or inkjet printers that can process the usual paper formats, manual intervention is rarely necessary today.
Printers under Mac OS and Airprint
Thanks to Cups and Raspberry, the original software also accepts the label printer on the Mac via the network.
IDG
On the Mac, go to System Preferences and then to the “Printers & Scanners” section.
In the following dialog, click on the plus sign on the left-hand side to add a printer. As the necessary Apple protocol was also installed during the installation of Cups in the current versions of the Raspberry OS, the printer should be found with the name used under Cups.
Now you need to tell Mac OS which driver you want to use. To do this, click on “Select software” under “Use.” In the following list, decide on the desired model.
Apple has also remained true to itself with regard to printers and has developed its own protocol for wireless printing with Airprint. It is based on the “Bonjour” service that has been around for years.
In order for a printer connected to the Raspberry Pi to be used as a “network printer” via Airprint, the “Avahi Daemon” must be running on the system.
Depending on the version of the OS used on the Pi, this must be installed manually via the package management.
In the current version, this is already done thanks to the installation of Cups.
If you have an iPad or iPhone in your home, you can easily check the correct setup by using the share function in an app and then selecting “Print.” You should then be able to select the printer there.
Example scenario with Label Writer
A Dymo Label Writer has been working reliably at the author’s workplace for some time — albeit connected directly to a local computer.
Other members of the household have not yet had access to it. Thanks to programs such as Lprint, the device is supported by all operating systems.
With Raspberry, Cups, and the latest drivers, this is now changing. To be able to access all models when setting up under Cups, first install a package with additional drivers from the manufacturer. This is generally good advice for printers from all manufacturers.
Using
apt install printer-driver-dymo
the package is loaded (with PPD files), installed, and integrated into Cups. Once this preparatory step has been completed, we set up the new printer as described above. Layouts, label selection, and thus communication with the printer are then handled by the application software.
The printer should then be available as soon as you have set it up on a client. Unless the program uses its own proprietary approach. For special printers, you will have to search for a PPD file manually, as different paper and media formats are used.
Without a PPD file, the printer can probably be addressed and the printout may also start. However, the result may then be that an A4 test page is reduced in size so that it fits on an address label.