This is a CUPS backend script that acts as a gateway for print jobs. Before releasing a job to a printer, it sends a POST request with job metadata to Spaceport. The job is only printed if the API returns a 200 OK response.
This allows for billing prints in Protocoin.
- Intercepts print jobs from CUPS.
- Notifies Spaceport about new print jobs (user, job title, etc.).
- Releases jobs to the physical printer only upon successful API confirmation.
- Works with any real CUPS backend (e.g.,
socket,ipp,lpd).
Needs:
- A Debian Linux VM
- Python 3.6+
Set up CUPS:
$ sudo apt install cups
$ sudo usermod -aG lpadmin $USER
$ sudo cp cupsd.conf /etc/cups/cupsd.conf
$ sudo systemctl restart cups
Details:
- Name: EpsonStylusPro3880
- Description: Epson Stylus Pro 3880
- Location: Classroom
- Driver: Local Raw Printer (grayscale, 2-sided printing)
- Connection:
printmanager:socket://172.17.18.23 - Sharing: Yes
Setup:
- CUPS admin
- add Printer
- select "EpsonStylusPro3880"
- set name to "EpsonStylusPro3880"
- enable sharing
- run:
$ sudo lpadmin -p EpsonStylusPro3880 -v "printmanager:socket://172.17.18.23"
Clone the repo and install:
$ cd
$ git clone https://github.com/Protospace/protoprint.git
$ sudo cp main.py /usr/lib/cups/backend/printmanager
$ sudo chown root:root /usr/lib/cups/backend/printmanager
$ sudo chmod 755 /usr/lib/cups/backend/printmanager
$ sudo touch /var/log/protoprint.log
$ sudo chown lp:lp /var/log/protoprint.log
$ sudo systemctl restart cups
Printer settings:
- add printer (manually)
- select a printer by name
- "http://172.17.17.181:631/printers/EpsonStylusPro3880"
- select "Epson Stylus Pro 3880" from driver list (could be at bottom)
- open printer > Additional printer settings > Rename > "Epson Stylus Pro 3880 Protocoin"
Restrict printing:
- open web interface http://172.17.18.23/
- Configuration > Printing Control
- Printing Control: Enable
- Printer Access Control: Allow
- add server running Protoprint to list, ie.
172.17.17.181 - 172.17.17.181
- hit Submit