Show
Ignore:
Timestamp:
09/04/06 11:14:02 (18 years ago)
Author:
jerome
Message:

Now uses the maximum between the value computed natively and the value
reported with ghostscript, instead of returning 0 pages when ghostscript
was needed but failed.

Files:
1 modified

Legend:

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

    r371 r384  
    168168            self.logdebug("%s * page #%s" % (copies, pnum)) 
    169169        self.logdebug("Internal parser said : %s pages" % pagecount) 
    170          
    171         if notrust :     
    172             pagecount = 0 # Let gs do counting 
    173         return pagecount 
     170        return (pagecount, notrust) 
    174171         
    175172    def getJobSize(self) :     
    176173        """Count pages in PostScript document.""" 
    177174        self.copies = 1 
    178         return self.natively() or self.throughGhostScript() 
     175        (nbpages, notrust) = self.natively() 
     176        newnbpages = nbpages 
     177        if notrust : 
     178            try : 
     179                newnbpages = self.throughGhostScript() 
     180            except pdlparser.PDLParserError, msg : 
     181                self.logdebug(msg) 
     182        return max(nbpages, newnbpages)     
    179183         
    180184def test() :