For my paperless-ngx install, I wanted to be able to easily "print"
to it from anywhere in my network. I find this is slightly easier than logging in to the interface or dragging/dropping
to the consume
folder for some docs.
One of the hardest parts of this setup was making the printer available on the network and visible accepting postscript.
Quick Install
The fastest way to get this running is to check out the repo cups-virtual-printer.
Explanation
This system is composed of two parts:
- Cupsd printer with
printer-driver-cups-pdf
configured to output to/mnt/output
avahi-daemon
, configured to use a customservice
file and with dbus disabled (it'd work with dbus, but one less dependency!)
In addition, the docker container needed to be configured with macvlan
so that the container had a "real" IP and
was able to expose avahi discovery on the network.
Compose file
cups-virtual-printer docker image
version: "3.4"
services:
printserver:
build: .
restart: unless-stopped
networks:
- cups-vlan
volumes:
- /tmp/output:/mnt/output
ports:
- 631:631 # Expose HTTP server
networks:
cups-vlan:
driver: macvlan
driver_opts:
parent: eth0 # Update as necessary
ipam:
config:
- subnet: "192.168.0.0/24"
ip_range: "192.168.0.12/32" #static IP
gateway: "192.168.0.1"
Conclusion
The hardest part of this setup was figuring out all the configuration to make the system work as expected. After that a lot of trial and error, the service now works reliably. I use it to write a pdf to the consume-directory of my paperless-ngx installation, which then ingests the file.