root / pkpgcounter / trunk / bin / pkpgcounter @ 439

Revision 439, 3.4 kB (checked in by jerome, 17 years ago)

Now recognizes the GC pseudo colorspace to differentiate
between grayscale and coloured pages.

  • Property svn:executable set to *
  • Property svn:keywords set to Auth Date Id Rev
Line 
1#! /usr/bin/env python
2# -*- coding: ISO-8859-15 -*-
3#
4# pkpgcounter : a generic Page Description Language parser
5#
6# (c) 2003, 2004, 2005, 2006 Jerome Alet <alet@librelogiciel.com>
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20#
21# $Id$
22#
23#
24
25import sys
26from pkpgpdls.version import __version__, __author__, __authoremail__, \
27                                __years__, __gplblurb__
28from pkpgpdls import analyzer
29
30__doc__ = """pkpgcounter v%(__version__)s (c) %(__years__)s %(__author__)s
31
32pkpgcounter is a generic Page Description Language parser.
33
34pkpgcounter parses any number of input files and/or its standard input
35and outputs the number of pages needed to print these documents.
36
37pkpgcounter can also compute the percent of ink coverage in different
38colorspaces for several file formats.
39
40pkpgcounter currently recognizes the following document formats :
41
42    * PostScript (both DSC compliant and binary)
43    * PDF   
44    * PCLXL (aka PCL6)
45    * PCL3/4/5 (mostly)
46    * DVI
47    * Plain text
48    * TIFF
49    * ESC/P2
50    * OpenDocument (ISO/IEC DIS 26300)
51    * Zenographics ZjStream
52    * Samsung QPDL (aka SPL2)
53    * Samsung SPL1
54
55The five latter ones, as well as some TIFF documents, are currently
56only supported in page counting mode.
57
58command line usage :
59
60  pkpgcounter [options] [files]
61
62options :
63
64  -v | --version        Prints pkpgcounter's version number then exits.
65  -h | --help           Prints this message then exits.
66 
67  -d | --debug          Activate debug mode.
68 
69  -cCOLORSPACE, --colorspace=COLORSPACE
70                        Activate the computation of ink usage, and defines the
71                        colorspace to use. Supported values are 'BW' (Black),
72                        'RGB', 'CMYK', 'CMY', and 'GC' (Grayscale vs Color).
73                        'GC' is useful if you only need to differentiate
74                        grayscale pages from coloured pages but don't care
75                        about ink usage per se.
76                       
77  -rRESOLUTION, --resolution=RESOLUTION
78                        The resolution in DPI to use when checking ink usage.
79                        Lower resolution is faster but less accurate. Default
80                        is 72 dpi.
81 
82examples :                             
83
84  $ pkpgcounter file1.ps file2.escp2 file3.pclxl <file4.pcl345
85 
86  Will launch pkpgcounter and will output the total number of pages
87  needed to print all the documents specified.
88 
89  $ pkpgcounter --colorspace bw --resolution 150 file1.ps
90 
91  Will output the percent of black ink needed on each page of
92  the file1.ps file rendered at 150 dpi.
93 
94%(__gplblurb__)s 
95
96Please e-mail bugs to: %(__authoremail__)s"""
97
98if __name__ == "__main__" : 
99    if (len(sys.argv) >= 2) and (sys.argv[1] in ("-h", "--help")) :
100        print __doc__ % globals()
101    else :   
102        analyzer.main()
Note: See TracBrowser for help on using the browser.