GithubHelp home page GithubHelp logo

cupsutils's Introduction

CupsUtils

Usage

Open terminal and execute following commands.

Go to the build dir:

cd <path-to-build-dir>

getPrinters

./getPrinters

Returns local printers list.

listOptionsForPrinterName

./listOptionsForPrinterName <printer-name>

Return list of printer options and values.

setOptionForPrinterWithName

./setOptionForPrinterWithName <printer-name> <option-name> <option-value>

Set option value for printer.

It is equivalent for:

lpadmin -p printer -o <option-name>=<option-value>

The command:

./setOptionForPrinterWithName <printer-name> device-uri <new-device-uri>

Is equvalent for:

lpadmin -p printername -v device-uri

Set printer hold new jobs until indefinite

lpadmin -p printer -o job-hold-until-default=indefinite

Get the device_uri for specified printer name, which is obtained from getPrinters command.

./getURIForPrinterName <printer-name>

Listening to CUPS notifications

Usage Scenario: tea4cups alternative

  1. Install printing operations policy:
./policyManager.py -f /etc/cups/cupsd.conf -i

This policy will specify that only root can release, continue or set job attributes.

  1. Get list of printers
./getPrinters
  1. Make desired printers hold job until indefinite by default
./setPrinterJobHoldUntilDefaultIndefinite <printer-name>
  1. Make desired printers use custom printing operation policy that was installed by policyManager
./setOptionForPrinterName <printer-name> printer-op-policy printingdlp
  1. You can be notified when new print job added:
./cupsNotificationsListenerOSX
  1. Once print job job is added, it becames on pause.
  2. You can obtain printing document from job:
./getDocument
  1. You can do your activity with the job: read attributes, inspect print data. The job will be holded.
  2. You can release job or cancel it:
./releaseJob

For canceling, see CupsUtils.hpp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.