# Manage printers with pkprinters

Last modified on $Date: 2005-10-09 22:39:06 +0200 (So, 09. Okt 2005) $

`pkprinters` is the preferred tool to manage printers in PyKota. It only manages printers, and do it well. With it you can add or delete printers or printer groups, or modify existing printers or printers groups. This is also the tool to use to put printers into one or more printers groups.

The very first thing you have to do once PyKota is installed but before it can work, is to add into PyKota's database an entry for each of the print queues on which you want to have print quota or accounting. Although the `pkturnkey` command can be used to initialize your database and import printers into it, the `pkprinters` command offers additionnal functionnalities like full management of printers.

Let's say your printing system has several print queues defined : `HP2100`, `TekTro`, and `StylusColor1` and `StylusColor2`. You want to charge 5 cents per page on each of this print queues. You just have to type :

    $ pkprinters --add --charge 0.05 HP2100 TekTro StylusColor1 StylusColor2

## Warning

Printers' names in PyKota are case-sensitive, so be careful to use the exact names exposed by your printing system.

After some minutes, you think that you should charge more on the `StylusColor1` and `StylusColor2` because they can do color. You also want to enter a description for these printers, because you have several of them :

    $ pkprinters --charge 0.25 "StylusColor*"
    $ pkprinters --description "Stylus Color 900 First floor" StylusColor1
    $ pkprinters --description "Stylus Color 900 Second floor" StylusColor2

You can now verify what you did :

    $ pkprinters --list
    HP2100 [] (0.0 + #*0.05)
    TekTro [] (0.0 + #*0.05)
    StylusColor1 [Stylus Color 900 First floor] (0.0 + #*0.25)
    StylusColor2 [Stylus Color 900 Second floor] (0.0 + #*0.25)

The command above has listed all print queues present in PyKota's database, along with their optional description and their base cost formula. The cost formula includes the price per job, `0.0` in our examples, and the price per page (`#` representing the number of pages).

If you defined printers groups, then the total cost is computed as the recursive sum of the printing cost on the current printer plus all the printers groups it is a member of. In addition, each user can have an overcharging (or undercharging) factor, by which the total printing cost will be multiplied to determine the real cost of printing on a particular printer for a particular user.

## Reference

            pkprinters
            -v--version
            -h--help
            -a--add
            -d--delete

              -D desc
              --description desc

            -r--remove

              -c p,j
              --charge p,j

              -g pgroup1,pgroup2,...
              --groups pgroup1,pgroup2,...

            -l--list
            -r--remove
            -s--skipexisting

              -m s
              --maxjobsize s

            -p--passthrough
            -n--nopassthrough