A dockerized version of CUPS Filters with a set of API for managing printers and print jobs
378
A dockerized version of CUPS Filters with a set of API for managing printers and print jobs
This project was born to address a scenario where there are:
cups that manages printer queuesfoomatic-rip that manages the rendering phaseIf you need to setup a similar environment, you should also consider to run the cups container https://hub.docker.com/repository/docker/drcoccodrillus/cups/general
This dockerized version of CUPS Filters aims to be a good solution for those scenarios where is needed a server side rendering and a client side printing. This docker container does its work in combo with this: https://hub.docker.com/r/drcoccodrillus/cups
docker pull drcoccodrillus/cups-filters
You can start a working container using this docker-compose.yml
version: "3.8"
services:
cups:
image: drcoccodrillus/cups-filters:latest
container_name: cups-filters
restart: always
privileged: true
networks:
printer-network:
ipv4_address: 172.28.0.3
networks:
printer-network:
name: printer-network
driver: bridge
ipam:
config:
- subnet: 172.28.0.0/16
gateway: 172.28.0.1
Before starting the cups-filters container, remember to start this dockerized version of CUPS https://hub.docker.com/r/drcoccodrillus/cups or to have a CUPS Server running and configured for accepting print jobs from the network. As default settings, this containerized cups-filters process the encoded PDF payload received through the API using Generic-PDF_Printer-PDF.ppd then sends print jobs to a CUPS Server with IP 172.28.0.2 and listening on default 631. You can modify this (useless) default settings changing the config.py constants CUPS_HOST and PPD. You can do that jumping in a running container and modifying it as needed or (better) building the image from scratch starting from the source: https://github.com/drcoccodrillus/docker-cups-filters
A set of API is defined to make it easy sending print jobs or querying CUPS. In case you run this project dockerized use the first url to invoke the API. Instead, if you run this project directly on your host machine, use the second url.
Returns the queue for gprinter
http://172.28.0.3:5000/api/v1/print-jobs
http://localhost:5000/api/v1/print-jobs
Returned JSON
[{"id": "gprinter-1", "owner": "thedude", "size": "182272", "date": "24 mar 2023,", "time": "11:58:29"}]
Returns a list of configured printers within their status
http://172.28.0.3:5000/api/v1/printer-status
http://localhost:5000/api/v1/printer-status
Returned JSON
[{"printer": "gprinter", "status": "enabled", "date": "24 mar 2023", "time": "11:58:29"}]
Returns a list of printers connected through USB cable
http://172.28.0.3:5000/api/v1/printer-details
http://localhost:5000/api/v1/printer-details
Returned JSON
[{"connection": "direct", "uri": "usb://Xerox/WorkCentre%20PE114%20Series?serial=3429108682......"}]
Receives a base64 encoded PDF
http://172.28.0.3:5000/api/v1/print-base64
http://localhost:5000/api/v1/print-base64
Returned JSONs
Successful print
{"message": "PDF printed"}
Errors
It didn't receive a valid base64 PDF
{"message": "Error: No PDF provided"}
Content type
Image
Digest
sha256:8850af0b5…
Size
274.9 MB
Last updated
over 3 years ago
docker pull drcoccodrillus/cups-filters