Changeset 1566
- Timestamp:
- 06/25/04 01:09:53 (20 years ago)
- Location:
- pykota/trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/NEWS
r1564 r1566 25 25 26 26 - Fixed PCL5 parser according to the sources of rastertohp. 27 28 - Fixed number of copies handling in PCL5 parser : the number 29 of copies could vary from page to page. 27 30 28 31 - 1.19alpha25 : -
pykota/trunk/pykota/pdlanalyzer.py
r1564 r1566 22 22 # 23 23 # $Log$ 24 # Revision 1.12 2004/06/24 23:09:53 jalet 25 # Fix for number of copies in PCL5 parser 26 # 24 27 # Revision 1.11 2004/06/23 22:07:50 jalet 25 28 # Fixed PCL5 parser according to the sources of rastertohp … … 170 173 self.data = [] 171 174 self.pos = self.len = 0 172 copies = 1173 175 pagecount = resets = 0 174 176 tag = None 177 copies = {} 175 178 while 1 : 176 179 char = self.readone() … … 192 195 # <ESC>(f###W -> Start of a symbol set block 193 196 # <ESC>&b###W -> Start of configuration data block 194 # <ESC>&l###X -> Number of copies 197 # <ESC>&l###X -> Number of copies for current page 195 198 # <ESC>&n###W -> Starts an alphanumeric string ID block 196 199 # <ESC>&p###X -> Start of a non printable characters block … … 217 220 size = (size * 10) + int(char) 218 221 if char in tagend : 219 if (tag == "&l") and (char == "X") : 220 copies = size222 if (tag == "&l") and (char == "X") : # copies for current page 223 copies[pagecount] = size 221 224 elif (tag == "&l") and (char == "H") and (size == 0) : 222 225 pagecount += 1 # Eject if NumPlanes > 1 … … 242 245 # PCL files with this. If resets < 2, then the file is 243 246 # probably not a valid PCL file, so we return 0 244 return copies * (pagecount or ((resets - 3) * (resets > 2))) 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))) 250 251 # now handle number of copies for each page (may differ). 252 # in duplex mode, number of copies may be sent only once. 253 for pnum in range(pagecount) : 254 # if no number of copies defined, take the preceding one else 1. 255 nb = copies.get(pnum, copies.get(pnum-1, 1)) 256 pagecount += (nb - 1) 257 return pagecount 245 258 246 259 class PCLXLAnalyzer :