Changeset 1567
- Timestamp:
- 06/25/04 10:10:08 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/pdlanalyzer.py
r1566 r1567 22 22 # 23 23 # $Log$ 24 # Revision 1.13 2004/06/25 08:10:08 jalet 25 # Another fix for PCL5 parser 26 # 24 27 # Revision 1.12 2004/06/24 23:09:53 jalet 25 28 # Fix for number of copies in PCL5 parser … … 173 176 self.data = [] 174 177 self.pos = self.len = 0 175 pagecount = resets = 0178 pagecount = resets = ejects = backsides = 0 176 179 tag = None 177 180 copies = {} … … 223 226 copies[pagecount] = size 224 227 elif (tag == "&l") and (char == "H") and (size == 0) : 225 pagecount += 1 # Eject if NumPlanes > 1228 ejects += 1 # Eject 226 229 elif (tag == "&a") and (size == 2) : 227 pagecount+= 1 # Back side in duplex mode230 backsides += 1 # Back side in duplex mode 228 231 else : 229 232 # doing a read will prevent the seek … … 236 239 self.skip(size) 237 240 238 # if pagecount is still 0, we will returnthe number241 # if pagecount is still 0, we will use the number 239 242 # of resets instead of the number of form feed characters. 240 243 # but the number of resets is always at least 2 with a valid … … 244 247 # 1 more, we finally substract 3, and will test several 245 248 # PCL files with this. If resets < 2, then the file is 246 # probably not a valid PCL file, so we return 0 247 # TODO : this code is probably not needed anymore 248 # TODO : since we added more page ejections detections 249 pagecount = (pagecount or ((resets - 3) * (resets > 2))) 249 # probably not a valid PCL file, so we use 0 250 if not pagecount : 251 pagecount = (pagecount or ((resets - 3) * (resets > 2))) 252 else : 253 # here we add counters for other ways new pages may have 254 # been printed and ejected by the printer 255 pagecount += ejects + backsides 250 256 251 257 # now handle number of copies for each page (may differ).