Changeset 3495

Show
Ignore:
Timestamp:
03/16/09 11:32:09 (16 years ago)
Author:
jerome
Message:

Now correctly handles the <ESC>$b???W sequences.
IMPORTANT : a post-parsing adjustment was done for ImageRunner?
documents, which incremented the page count. This adjustment **might**
have been needed because of this bug. A new adjustment is now done for
ImageRunner? files, which decrements the page count instead. Seems to
work on the set of test files. Fixes #40.

Files:
1 modified

Legend:

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

    r3474 r3495  
    193193        #self.logdebug("AMP") 
    194194        self.handleTag(self.escamptags) 
     195 
     196    def escDollar(self) : 
     197        """Handles the ESC$ sequence.""" 
     198        #self.logdebug("DOLLAR") 
     199        self.handleTag(self.escdollartags) 
    195200 
    196201    def escStar(self) : 
     
    364369            if codop != self.imagerunnermarker2 : 
    365370                self.pos += length 
    366             self.logdebug("IMAGERUNNERTAG SKIP %i AT %08x" % (self.pos-oldpos, self.pos)) 
     371            self.logdebug("ImageRunner tag : Skip %i bytes from 0x%08x to 0x%08x" % (self.pos-oldpos, 
     372                                                                                     oldpos, 
     373                                                                                     self.pos)) 
    367374        else : 
    368375            self.pos -= 1 # Adjust position 
     
    416423        self.esctags[ord('%')] = self.escPercent 
    417424        self.esctags[ord('*')] = self.escStar 
     425        self.esctags[ord('$')] = self.escDollar 
    418426        self.esctags[ord('&')] = self.escAmp 
    419427        self.esctags[ord('(')] = self.escLeftPar 
     
    441449        self.escstartags[ord('m')] = self.escSkipSomethingW 
    442450        self.escstartags[ord('v')] = self.escSkipSomethingW 
     451 
     452        self.escdollartags = [ lambda : None ] * 256 
     453        self.escdollartags[ord('b')] = self.escSkipSomethingW 
    443454 
    444455        self.escleftpartags = [ lambda : None ] * 256 
     
    483494        self.logdebug("IsImageRunner : \t\t\t%s" % self.isimagerunner) 
    484495 
     496#        if self.isimagerunner : 
     497#            self.logdebug("Adjusting PageCount : +1") 
     498#            self.pagecount += 1      # ImageRunner adjustment 
    485499        if self.isimagerunner : 
    486             self.logdebug("Adjusting PageCount : +1") 
    487             self.pagecount += 1      # ImageRunner adjustment 
     500            self.logdebug("Adjusting PageCount : -1") 
     501            self.pagecount -= 1      # ImageRunner adjustment 
    488502        elif self.linesperpage is not None : 
    489503            self.logdebug("Adjusting PageCount : +1")