[753] | 1 | <!-- $Id$ --> |
---|
| 2 | |
---|
| 3 | <chapter> |
---|
[865] | 4 | <title id="filter">The pykota filter</title> |
---|
| 5 | |
---|
| 6 | <para>Last modified on $Date$</para> |
---|
| 7 | |
---|
[753] | 8 | <para> |
---|
[865] | 9 | To account for pages or eventually ink usage, you must plug your accounting |
---|
[959] | 10 | system somewhere into the printing system you use, be it either <application>CUPS</application> |
---|
| 11 | or <application>LPRng</application>. One way to do this without having |
---|
| 12 | to modify the printing system itself, is by using a <firstterm>filter</firstterm>. |
---|
[753] | 13 | </para> |
---|
[865] | 14 | |
---|
| 15 | <para> |
---|
| 16 | A filter is a computer program which takes data in one format as its input, and outputs the |
---|
| 17 | same data but transformed into another format. <application>CUPS</application> already |
---|
| 18 | contains many filters. For example there's one filter named <application>pstops</application> which accepts |
---|
| 19 | PostScript data as its input, and, as its name implies, outputs PostScript data too, but after having |
---|
| 20 | eventually rearranged the pages to fit several pages on a single sheet of paper, or other manipulations |
---|
[959] | 21 | like that. |
---|
[865] | 22 | </para> |
---|
| 23 | |
---|
| 24 | <para> |
---|
| 25 | The <application>pstops</application> filter described above is also in charge of doing basic page |
---|
| 26 | accounting, but <application>PyKota</application> currently doesn't use this facility since it may |
---|
| 27 | prove to be unreliable depending on the drivers used or if a paper jam occur for example. |
---|
| 28 | </para> |
---|
| 29 | |
---|
| 30 | <para> |
---|
[959] | 31 | <application>LPRng</application> can also use filters, one often used in combination with |
---|
| 32 | <application>LPRng</application> is <application>magicfilter</application> which can convert |
---|
| 33 | different input formats to native printers languages like PostScript or ESC/P2. |
---|
| 34 | </para> |
---|
| 35 | |
---|
| 36 | <para> |
---|
[865] | 37 | So to do its own accounting, <application>PyKota</application> has its own filter, named <application>pykota</application>, |
---|
[959] | 38 | which you have to plug into the different set of filters used by your printing system of choice. The procedure to |
---|
[865] | 39 | install the <application>pykota</application> filter is described in the |
---|
| 40 | <xref linkend="installation" endterm="installation"> chapter. |
---|
| 41 | </para> |
---|
| 42 | |
---|
| 43 | <para> |
---|
[959] | 44 | Currently with a <application>CUPS</application> backend, the <application>pykota</application> filter is used at the very last stage of the print mechanism, |
---|
[865] | 45 | just before the final data is sent to the printer, but it may eventually be used earlier with some |
---|
| 46 | modifications to <application>CUPS</application>'s filtering configuration. This is not tested yet, but this |
---|
| 47 | may be the solution to use <application>PyKota</application> with printers which really needs to have |
---|
[982] | 48 | a specific filter like <application>magicfilter</application> or <application>cupsomatic</application>, |
---|
[959] | 49 | i.e. non-postscript printers. This is a limitation in <application>CUPS</application> which doesn't really |
---|
| 50 | allow to specify multiple print filters for different purposes. This problem will be solved in <application>CUPS</application> |
---|
| 51 | version 1.2 and higher. |
---|
[865] | 52 | </para> |
---|
| 53 | |
---|
| 54 | <para> |
---|
[959] | 55 | When used with an <application>LPRng</application> backend, the accounting filter is not defined the same way |
---|
| 56 | input filters are, so the problem described above doesn't exist, and <application>PyKota</application> |
---|
| 57 | may work with non-postscript printers, provided they can report their page counter and you know how to do |
---|
| 58 | this. |
---|
[865] | 59 | </para> |
---|
| 60 | |
---|
[959] | 61 | <para> |
---|
| 62 | When you submit a print job, <application>pykota</application> is automatically launched by your printing system, |
---|
| 63 | so it has to detect which system you are using (<application>CUPS</application> or <application>LPRng</application>) |
---|
| 64 | and behave like if it was specifically designed for your printing system. Fortunately there's not a lot |
---|
| 65 | of differences, the more important one is the exit codes used to tell the printing environment if a job |
---|
| 66 | has to be accepted or rejected. |
---|
| 67 | </para> |
---|
| 68 | |
---|
| 69 | <para> |
---|
| 70 | <application>pykota</application> then asks the printer for its internal page counter, read from the Quota DataBase the internal |
---|
| 71 | page counter for this printer when the previous job was launched, computes the difference, and report it as the |
---|
| 72 | previous job's size in the Quota DataBase. It then updates the last user's print quota and account balance, and |
---|
| 73 | warn him if he is over quota or his account balance below 0. Finally it checks if the user who launched the |
---|
| 74 | current job is below or above his print quota, and either allow or deny the job's datas to pass to the underlying |
---|
| 75 | layer (the printer itself). |
---|
| 76 | </para> |
---|
| 77 | |
---|
| 78 | <para> |
---|
| 79 | If a problem occurs, it is logged either to the filter's standard output or to the system logger, depending on |
---|
| 80 | your preferences in <application>PyKota</application>'s configuration file. Also if a print quota is reached |
---|
| 81 | you may choose if the administrator, the user, both or noone will receive an email message explaining |
---|
| 82 | the situation and proposing a solution. |
---|
| 83 | </para> |
---|
| 84 | |
---|
[753] | 85 | </chapter> |
---|
| 86 | |
---|
| 87 | <!-- |
---|
| 88 | |
---|
| 89 | $Log$ |
---|
[982] | 90 | Revision 1.4 2003/04/30 20:00:51 jalet |
---|
| 91 | Typo |
---|
| 92 | |
---|
[959] | 93 | Revision 1.3 2003/04/24 21:09:47 jalet |
---|
| 94 | Documentation slightly improved. |
---|
| 95 | |
---|
[865] | 96 | Revision 1.2 2003/03/25 09:32:06 jalet |
---|
| 97 | Improved documentation. |
---|
| 98 | |
---|
[753] | 99 | Revision 1.1 2003/02/08 00:03:35 jalet |
---|
| 100 | Documentation skeleton added |
---|
| 101 | |
---|
| 102 | |
---|
| 103 | --> |
---|