Changeset 1690
- Timestamp:
- 09/02/04 00:31:49 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/pdlanalyzer.py
r1686 r1690 22 22 # 23 23 # $Log$ 24 # Revision 1.36 2004/09/01 22:31:49 jalet 25 # Some more work on ESC/P2 analyzer to avoid missing \r\n sequences. Not 26 # exactly optimal though... 27 # 24 28 # Revision 1.35 2004/08/30 23:10:24 jalet 25 29 # Improved the ESC/P2 analyzer so that more GhostScript devices are supported … … 243 247 # are two Reset Printer sequences (ESC + @) 244 248 marker1 = "\033@" 245 pagecount1 = 0246 249 247 250 # with other software or printer driver, we … … 250 253 marker2r = "\r\f\033" 251 254 marker2rn = "\r\n\f\033" 252 pagecount2 = 0253 255 254 256 # and ghostscript's stcolor for example seems to 255 257 # output ESC + @ + \f for each page plus one 256 258 marker3 = "\033@\f" 257 pagecount3 = 0258 259 259 260 # while ghostscript's escp driver outputs instead 260 261 # \f + ESC + @ 261 262 marker4 = "\f\033@" 262 pagecount4 = 0 263 264 for line in self.infile.xreadlines() : 265 pagecount1 += line.count(marker1) 266 generic = line.count(marker2r) 267 if not generic : 268 generic = line.count(marker2rn) 269 pagecount2 += generic 270 pagecount3 += line.count(marker3) 271 pagecount4 += line.count(marker4) 263 264 data = self.infile.read() 265 pagecount1 = data.count(marker1) 266 pagecount2 = max(data.count(marker2r), data.count(marker2rn)) 267 pagecount3 = data.count(marker3) 268 pagecount4 = data.count(marker4) 272 269 273 270 if pagecount2 : … … 279 276 else : 280 277 return int(pagecount1 / 2) 281 282 278 283 279 class PCLAnalyzer :