Show
Ignore:
Timestamp:
09/03/05 00:40:57 (19 years ago)
Author:
jerome
Message:

Added a PJL parsing module to extract SET and DEFAULT statements.
Improved general readability.
Fixed some minor problems thanks to pychecker.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/pkpgpdls/postscript.py

    r248 r252  
    3939              (self.firstblock.find("LANGUAGE = Postscript") != -1))) or \ 
    4040              (self.firstblock.find("%!PS-Adobe") != -1) : 
    41             if self.debug :   
    42                 sys.stderr.write("DEBUG: Input file is in the PostScript format.\n") 
     41            self.logdebug("DEBUG: Input file is in the PostScript format.") 
    4342            return 1 
    4443        else :     
     
    4746    def throughGhostScript(self) : 
    4847        """Get the count through GhostScript, useful for non-DSC compliant PS files.""" 
    49         if self.debug : 
    50             sys.stderr.write("Internal parser sucks, using GhostScript instead...\n") 
     48        self.logdebug("Internal parser sucks, using GhostScript instead...") 
    5149        self.infile.seek(0) 
    5250        command = 'gs -sDEVICE=bbox -dNOPAUSE -dBATCH -dQUIET - 2>&1 | grep -c "%%HiResBoundingBox:" 2>/dev/null' 
     
    8179        pages = {} 
    8280        pages[0] = { "copies" : 1 } 
     81        previousline = "" 
    8382        for line in self.infile.xreadlines() :  
    8483            if line.startswith(r"%%Page: ") : 
     
    130129            copies = page["copies"] 
    131130            pagecount += (copies - 1) 
    132             if self.debug : 
    133                 sys.stderr.write("%s * page #%s\n" % (copies, pnum)) 
     131            self.logdebug("%s * page #%s" % (copies, pnum)) 
    134132        return pagecount 
    135133