Changeset 418 for pkpgcounter/trunk

Show
Ignore:
Timestamp:
09/15/06 11:19:37 (18 years ago)
Author:
jerome
Message:

Added plain text parser with support for both page counting and ink coverage.

Location:
pkpgcounter/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/bin/pkpgcounter

    r386 r418  
    4545    * PCL3/4/5 (mostly) 
    4646    * DVI 
     47    * Plain text 
    4748    * TIFF 
    4849    * ESC/P2 
     
    5051    * Zenographics ZjStream 
    5152    * Samsung QPDL (aka SPL2) 
     53    * Samsung SPL1 
    5254 
    53 The four latter ones, as well as some TIFF documents, are currently  
     55The five latter ones, as well as some TIFF documents, are currently  
    5456only supported in page counting mode.  
    5557 
  • pkpgcounter/trunk/NEWS

    r406 r418  
    2222pkpgcounter News : 
    2323 
     24  * 2.10 : 
     25   
     26    - Added a plain text parser, with support for both page counting and 
     27      ink coverage. 
     28     
     29    - Added a minimal SPL1 parser. 
     30     
     31    - Fixed a problem in the PCLXL parser related to Kyocera printer drivers. 
     32     
    2433  * 2.00 : 
    2534   
  • pkpgcounter/trunk/pkpgpdls/plain.py

    r414 r418  
    2626import sys 
    2727import os 
    28 import mmap 
    2928 
    3029import pdlparser 
     
    3433class Parser(pdlparser.PDLParser) : 
    3534    """A parser for plain text documents.""" 
     35    enscript = 'enscript --quiet --portrait --no-header --columns 1 --output - | gs -sDEVICE=tiff24nc -dPARANOIDSAFER -dNOPAUSE -dBATCH -dQUIET -r%(dpi)i -sOutputFile="%(fname)s" -' 
     36    a2ps = 'a2ps --borders 0 --quiet --portrait --no-header --columns 1 --output - | gs -sDEVICE=tiff24nc -dPARANOIDSAFER -dNOPAUSE -dBATCH -dQUIET -r%(dpi)i -sOutputFile="%(fname)s" -' 
     37    def __init__(self, infile, debug=0, firstblock=None, lastblock=None) : 
     38        """Initialize the plain text parser.""" 
     39        pdlparser.PDLParser.__init__(self, infile, debug, firstblock, lastblock) 
     40         
     41        # Tries to detect is a plain text to PostScript command line tool is available 
     42        # and use the first one we find. 
     43        paths = os.environ.get("PATH", "/usr/local/bin:/usr/bin:/bin").split(os.pathsep) 
     44        for cmd in ("enscript", "a2ps") : 
     45            for path in paths : 
     46                if os.path.exists(os.path.join(path, cmd)) : 
     47                    self.totiffcommand = getattr(self, cmd) 
     48                    return 
     49         
    3650    def isValid(self) :     
    3751        """Returns True if data is plain text, else False. 
  • pkpgcounter/trunk/pkpgpdls/version.py

    r408 r418  
    2323 
    2424 
    25 __version__ = "2.01alpha" 
     25__version__ = "2.10" 
    2626 
    2727__doc__ = """pkpgcounter : a generic Page Description Languages parser.""" 
  • pkpgcounter/trunk/README

    r406 r418  
    3636        - DVI 
    3737         
     38        - Plain text 
     39         
    3840        - TIFF 
    3941         
     
    4648        - Samsung QPDL (aka SPL2) 
    4749         
    48 The four latter ones, as well as some TIFF documents, are currently  
     50        - Samsung SPL1 
     51         
     52The five latter ones, as well as some TIFF documents, are currently  
    4953only supported in page counting mode.  
    5054