[185] | 1 | # $Id$ |
---|
| 2 | |
---|
| 3 | pkpgcounter : a generic Page Description Language parser |
---|
| 4 | |
---|
[3474] | 5 | (c) 2003-2009 Jerome Alet <alet@librelogiciel.com> |
---|
[463] | 6 | This program is free software: you can redistribute it and/or modify |
---|
[185] | 7 | it under the terms of the GNU General Public License as published by |
---|
[463] | 8 | the Free Software Foundation, either version 3 of the License, or |
---|
[185] | 9 | (at your option) any later version. |
---|
| 10 | |
---|
| 11 | This program is distributed in the hope that it will be useful, |
---|
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 14 | GNU General Public License for more details. |
---|
| 15 | |
---|
| 16 | You should have received a copy of the GNU General Public License |
---|
[463] | 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
[185] | 18 | |
---|
| 19 | ============================================================================= |
---|
| 20 | |
---|
[375] | 21 | pkpgcounter is a generic Page Description Language parser which can either |
---|
| 22 | compute the number of pages in a document, or compute the percent of |
---|
| 23 | ink coverage needed to print each page, in different colorspaces. |
---|
[185] | 24 | |
---|
[375] | 25 | pkpgcounter currently recognizes the following document formats : |
---|
[185] | 26 | |
---|
| 27 | - PostScript (both DSC compliant and binary) |
---|
[3436] | 28 | |
---|
[185] | 29 | - PDF |
---|
[3436] | 30 | |
---|
[185] | 31 | - PCL3/4/5 |
---|
[3436] | 32 | |
---|
[185] | 33 | - PCLXL (aka PCL6) |
---|
[3436] | 34 | |
---|
[221] | 35 | - DVI |
---|
[3436] | 36 | |
---|
[528] | 37 | - OpenDocument (ISO/IEC DIS 26300) |
---|
[3436] | 38 | |
---|
[529] | 39 | - Microsoft Word (c) (tm) (r) (etc...) |
---|
[3436] | 40 | |
---|
[418] | 41 | - Plain text |
---|
[3436] | 42 | |
---|
[221] | 43 | - TIFF |
---|
[3436] | 44 | |
---|
[502] | 45 | - Several other image formats |
---|
[3436] | 46 | |
---|
[375] | 47 | - ESC/P2 |
---|
[3436] | 48 | |
---|
[329] | 49 | - Zenographics ZjStream |
---|
[3436] | 50 | |
---|
[386] | 51 | - Samsung QPDL (aka SPL2) |
---|
[3436] | 52 | |
---|
[418] | 53 | - Samsung SPL1 |
---|
[3436] | 54 | |
---|
[473] | 55 | - ESC/PageS03 |
---|
[3436] | 56 | |
---|
[480] | 57 | - Brother HBP |
---|
[3409] | 58 | |
---|
| 59 | - Brother XL2HB |
---|
[3436] | 60 | |
---|
[485] | 61 | - Hewlett-Packard Lightweight Imaging Device Interface Language |
---|
[3436] | 62 | |
---|
[539] | 63 | - Structured Fax |
---|
[3436] | 64 | |
---|
[556] | 65 | - Canon BJ/BJC |
---|
[3436] | 66 | |
---|
[556] | 67 | - ASCII PNM (Netpbm) |
---|
[185] | 68 | |
---|
[3436] | 69 | The eleven latter ones, as well as some TIFF documents, are currently |
---|
| 70 | only supported in page counting mode. |
---|
[368] | 71 | |
---|
[3436] | 72 | By default, when launched pkpgcounter prints on its standard output |
---|
| 73 | a single integer representing the total number of pages in all the |
---|
| 74 | files which filenames you've passed on the command line. |
---|
| 75 | |
---|
[185] | 76 | With no argument, or with a single dash in non-option arguments, |
---|
| 77 | pkpgcounter reads datas to parse from its standard input in addition |
---|
| 78 | to other non-options arguments which are treated as filenames |
---|
| 79 | representing the files to parse. |
---|
| 80 | |
---|
[375] | 81 | See pkpgcounter --help for details and examples. |
---|
[185] | 82 | |
---|
| 83 | ============================================================================= |
---|
| 84 | |
---|
| 85 | Installation : |
---|
| 86 | -------------- |
---|
| 87 | |
---|
| 88 | 0 - Download pkpgcounter from : |
---|
[3436] | 89 | |
---|
[336] | 90 | http://www.pykota.com/software/pkpgcounter/download |
---|
[3436] | 91 | |
---|
| 92 | and extract it : |
---|
| 93 | |
---|
[185] | 94 | $ tar -zxf pkpgcounter-x.yy.tar.gz |
---|
[3436] | 95 | |
---|
[185] | 96 | where x.yy is pkpgcounter' version number. |
---|
[3436] | 97 | |
---|
[204] | 98 | 1 - Run the installation script : |
---|
[3436] | 99 | |
---|
[204] | 100 | $ python setup.py install |
---|
[3436] | 101 | |
---|
| 102 | This will usually install the pkpgcounter into /usr/bin and |
---|
[235] | 103 | the library into /usr/lib/python2.?/site-packages/pkpgpdls/ |
---|
[3436] | 104 | |
---|
[185] | 105 | 2 - Use pkpgcounter : |
---|
[3436] | 106 | |
---|
[185] | 107 | $ pkpgcounter file1.ps file2.pclxl ... <fileN.escp2 |
---|
[3436] | 108 | |
---|
[185] | 109 | pkpgcounter will display the total size in pages of all the files |
---|
| 110 | passed on the command line. |
---|
[3436] | 111 | |
---|
[374] | 112 | $ pkpgcounter --colorspace bw --resolution 150 file1.ps |
---|
[3436] | 113 | |
---|
[374] | 114 | Will output the percent of black ink needed on each page of |
---|
| 115 | the file1.ps file rendered at 150 dpi. |
---|
[3436] | 116 | |
---|
| 117 | 3 - That's all ! |
---|
| 118 | |
---|
[527] | 119 | DEPENDENCIES : |
---|
| 120 | |
---|
[528] | 121 | Most of the time, pkpgcounter only depends on the presence of : |
---|
[3436] | 122 | |
---|
[528] | 123 | - The Python Imaging Library (python-imaging) |
---|
[3436] | 124 | |
---|
[528] | 125 | But, depending on the file formats you plan to work with, and on the |
---|
| 126 | accounting mode you want to use (pages vs ink), you may need to install |
---|
| 127 | some or all of the additional software listed below. Usually, if one is |
---|
[3436] | 128 | needed then pkpgcounter will complain. So your best bet is probably |
---|
[528] | 129 | to NOT INSTALL anything until pkpgcounter asks you to do so on its |
---|
| 130 | standard error stream. Here's the list of software which may be needed |
---|
| 131 | for some operations with pkpgcounter : |
---|
[527] | 132 | |
---|
| 133 | - GhostScript (gs) |
---|
[3436] | 134 | |
---|
[527] | 135 | - The X Virtual Frame Buffer (xvfb) |
---|
[3436] | 136 | |
---|
[527] | 137 | - The X authority file utility xauth (xbase-clients) |
---|
[3436] | 138 | |
---|
[527] | 139 | - The dvips converter from TeX DVI to PostScript (tetex-bin) |
---|
[3436] | 140 | |
---|
[527] | 141 | - The ImageMagick image manipulation toolkit (imagemagick) |
---|
[3436] | 142 | |
---|
[527] | 143 | - The AbiWord word processor (abiword) |
---|
[374] | 144 | |
---|
[527] | 145 | - The GhostPCL/GhostPDL's pcl6 converter from PCL to PostScript |
---|
[3436] | 146 | |
---|
[185] | 147 | ============================================================================= |
---|
| 148 | |
---|
[3436] | 149 | Troubleshooting : |
---|
[185] | 150 | ----------------- |
---|
| 151 | |
---|
| 152 | If pkpgcounter gives incorrect results to you, please make an incorrectly |
---|
[3436] | 153 | parsed data file available to us on some website, and tell us which |
---|
| 154 | driver was used, how many pages are in the file, and any additional |
---|
[528] | 155 | information you think is relevant. |
---|
[3436] | 156 | |
---|
[247] | 157 | If pkpgcounter complain about your system lacking the Python Psyco module, |
---|
| 158 | please consider installing it to speedup file parsing. However, don't forget |
---|
[3436] | 159 | that Psyco currently only runs on the 32 bits x86 platform, so no need to |
---|
[247] | 160 | install it if you've got another system type. |
---|
[3436] | 161 | |
---|
[185] | 162 | ============================================================================= |
---|
| 163 | |
---|
[406] | 164 | Before pkpgcounter v1.86, the PCL3/4/5 parser was a Python backport of an early |
---|
[286] | 165 | release of the PCLCount software by Eduardo Gielamo Oliveira and Rodolfo Broco |
---|
[406] | 166 | Manin, available from : |
---|
[286] | 167 | |
---|
| 168 | http://www.fea.unicamp.br/pclcount/ |
---|
[3436] | 169 | |
---|
| 170 | Their software is distributed under either the terms of a BSD-like license, |
---|
[286] | 171 | or the terms of the GNU General Public License of the Free Software Foundation. |
---|
| 172 | |
---|
[406] | 173 | Beginning with pkpgcounter v1.86, the PCL3/4/5 parser was rewritten from |
---|
| 174 | scratch, and is now much more readable, maintainable, and of course accurate. |
---|
| 175 | |
---|
[463] | 176 | The old parser was still available until pkpgcounter v2.18 was published, but |
---|
| 177 | was definitely removed after that, just before pkpgcounter v3.00 was published. |
---|
[3436] | 178 | |
---|
| 179 | pkpgcounter's PCLXL (aka PCL6) parser doesn't originate from PCLCount, but |
---|
[406] | 180 | was written from scratch, just like all the other parsers included in |
---|
| 181 | pkpgcounter. |
---|
[286] | 182 | |
---|
| 183 | ============================================================================= |
---|
| 184 | |
---|
[3436] | 185 | pkpgcounter's ink coverage algorithm for the CMYK colorspace is a |
---|
| 186 | direct Python port from the PrintBill project by Daniel Franklin. |
---|
| 187 | PrintBill is distributed under the terms of the GNU General Public |
---|
| 188 | License of the Free Software Foundation, version 2 or higher. The |
---|
| 189 | algorithms used for the other colorspaces are a complete rewrite of |
---|
| 190 | PrintBill's algorithms using both Python and the Python Imaging |
---|
| 191 | Library's facilities. |
---|
[368] | 192 | |
---|
| 193 | ============================================================================= |
---|
| 194 | |
---|
[3381] | 195 | Please report any problem to the bug tracker at http://trac.pykota.com |
---|