Skip to content

Printing

Available since: brezel/api@2.11.x

You can print documents from Brezel using workflows and action/print.

This utilizes the https://github.com/rawilk/laravel-printing library and the CUPS printing system.

Setup a CUPS server

  1. Install CUPS on a server that is in the same network as your printer. sudo apt install cups
  2. Start CUPS sudo systemctl start cups and enable it to start on boot sudo systemctl enable cups
    • If you are using WSL2, use sudo service cups start to start CUPS. Remember, you need to to this every time you restart WSL2!
  3. Find out your printers IPP address.
    • It can be found in the printers settings or by printing a network configuration page.
    • The printer might give you the address in the format http://... or https://.... You need to convert it to ipp://....
  4. Add your printer to CUPS. This has to be done only once.
    • sudo lpadmin -p A_NAME_FOR_YOUR_PRINTER -m everywhere -o printer-is-shared=true -E -v ipp://THE_IPP_ADDRESS_OF_YOUR_PRINTER
    • Example: sudo lpadmin -p epson -m everywhere -o printer-is-shared=true -E -v ipp://192.168.2.44:631/ipp/print
  5. Optionally validate your config by running sudo lpoptions -d A_NAME_FOR_YOUR_PRINTER
  6. Now get the url to your CUPS instance
    • Example: http://localhost:631
    • This is the URL you will use in the configuration of your Brezel

  7. Get the id (url in CUPS) of your printer. You can find it in the CUPS web interface at http://localhost:631/printers/.
    • Example: ipp://localhost:631/printers/epson
    • This is the printer id you will use in the configuration of your Brezel

Configure in Brezel

Set the env variables

CUPS_SERVER_IP=your-cups-server-host
CUPS_SERVER_PORT=631
PRINT_DEFAULT_PRINTER_ID=ID_OF_YOUR_PRINTER

With the example above, if I want to use the printer epson on the CUPS server at http://localhost:631, I would set the following env variables:

CUPS_SERVER_IP=localhost
CUPS_SERVER_PORT=631
PRINT_DEFAULT_PRINTER_ID=ipp://localhost:631/printers/epson

Secure your CUPS server

You can also use a username and password to secure your CUPS server. Set the following env variables in brezel if you configured this:

CUPS_SERVER_USERNAME=your-username
CUPS_SERVER_PASSWORD=your-password

Usage

Put a File entity into the input of an action/print workflow element and watch the magic happen.