Show
Ignore:
Timestamp:
04/12/05 08:16:35 (19 years ago)
Author:
jerome
Message:

Use raw strings now, maybe it will help with the psyco problem

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/pdlanalyzer/pdf.py

    r200 r208  
    3131    def getJobSize(self) :     
    3232        """Counts pages in a PDF document.""" 
    33         regexp = re.compile(r"(/Type) ?(/Page)[/ \t\r\n]") 
     33        self.iscolor = None 
     34        newpageregexp = re.compile(r"(/Type) ?(/Page)[/ \t\r\n]", re.I) 
     35        colorregexp = re.compile(r"(/ColorSpace) ?(/DeviceRGB|/DeviceCMYK)[/ \t\r\n]", re.I) 
    3436        pagecount = 0 
    3537        for line in self.infile.xreadlines() :  
    36             pagecount += len(regexp.findall(line)) 
     38            pagecount += len(newpageregexp.findall(line)) 
     39            if colorregexp.match(line) : 
     40                self.iscolor = 1 
     41                if self.debug : 
     42                    sys.stderr.write("ColorSpace : %s\n" % line) 
    3743        return pagecount     
    3844