Changeset 444

Show
Ignore:
Timestamp:
01/22/07 23:09:19 (18 years ago)
Author:
jerome
Message:

Fixed a problem with PostScript? parser and some printer drivers.

Location:
pkpgcounter/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/NEWS

    r443 r444  
    2222pkpgcounter News : 
    2323 
     24  * 2.14 : 
     25   
     26    - Fixed a problem with some PS drivers which don't output %%Page: 
     27      comments. 
     28       
    2429  * 2.13 :  
    2530    
  • pkpgcounter/trunk/pkpgpdls/postscript.py

    r443 r444  
    9090        prescribe = 0 # Kyocera's Prescribe commands 
    9191        acrobatmarker = 0 
     92        pagescomment = None 
    9293        for line in self.infile.xreadlines() :  
    9394            if (not prescribe) and line.startswith(r"%%BeginResource: procset pdf") \ 
     
    9899            elif line.startswith("!R!") : 
    99100                prescribe = 1 
     101            elif line.startswith(r"%%Pages: ") : 
     102                try : 
     103                    pagescomment = int(line.split()[1]) 
     104                except ValueError : 
     105                    pass # strange, to say the least 
    100106            elif line.startswith(r"%%Page: ") or line.startswith(r"(%%[Page: ") : 
    101107                proceed = 1 
     
    177183            pagecount += (copies - 1) 
    178184            self.logdebug("%s * page #%s" % (copies, pnum)) 
     185             
     186        if not pagecount and pagescomment :     
     187            pagecount = pagescomment 
    179188        self.logdebug("Internal parser said : %s pages" % pagecount) 
    180189        return (pagecount, notrust) 
     
    185194        (nbpages, notrust) = self.natively() 
    186195        newnbpages = nbpages 
    187         if notrust : 
     196        if notrust or not nbpages : 
    188197            try : 
    189198                newnbpages = self.throughGhostScript() 
  • pkpgcounter/trunk/pkpgpdls/version.py

    r443 r444  
    2323 
    2424 
    25 __version__ = "2.14alpha" 
     25__version__ = "2.14" 
    2626 
    2727__doc__ = """pkpgcounter : a generic Page Description Languages parser."""