Skip to content

iqe/cups-rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CUPS REST API

This project provides a minimal REST API for printing PDF files and listing printers using CUPS.

Installation

To run with Docker:

docker build -t cups-rest-api .
docker run -it --rm -p 4567:4567 -p 631:631 -v ./config:/etc/cups cups-rest-api:latest

For other configuration options, see https://github.com/anujdatar/cups-docker/, which this Dockerfile is mostly copied from.

Usage

List Printers

  • Endpoint: GET /printers
  • Description: Returns a list of available printers with their names and descriptions.
  • Example:
    curl http://localhost:4567/printers

Print a PDF

  • Endpoint: POST /printers/your_printer_name/jobs
  • Description: Print a PDF by sending the PDF data in the request body.
  • Parameters:
    • printer_name (path parameter): Name of the printer to use.
    • Optional: Print options as query parameters.
  • Example:
    curl -X POST \
      -H "Content-Type: application/pdf" \
      --data-binary @file.pdf \
      "http://localhost:4567/printers/PRINTER_NAME/jobs"

Manage CUPS

You can manage CUPS settings and printers via the CUPS web interface at http://localhost:631, if exposed.

Credits

The Dockerfile is mostly copied from https://github.com/anujdatar/cups-docker/.

About

(Very) minimal API to submit PDFs to CUPS via HTTP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published