Changeset 399 for pkpgcounter/trunk/pkpgpdls
- Timestamp:
- 09/08/06 23:16:23 (18 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/pkpgpdls/newpcl345.py
r398 r399 364 364 self.pos += 1 365 365 366 def handleImageRunner(self) : 367 """Handles Canon ImageRunner tags.""" 368 tag = self.readByte() 369 if tag == ord(self.imagerunnermarker1[-1]) : 370 oldpos = self.pos-2 371 codop = self.minfile[self.pos:self.pos+2] 372 length = unpack(">H", minfile[pos+6:pos+8])[0] 373 self.pos += 18 374 if codop != self.imagerunnermarker2 : 375 self.pos += length 376 self.logdebug("IMAGERUNNERTAG SKIP %i AT %08x" % (self.pos-oldpos, self.pos)) 377 else : 378 self.pos -= 1 # Adjust position 379 366 380 def getJobSize(self) : 367 381 """Count pages in a PCL5 document. … … 396 410 self.endgfx = [] 397 411 self.hpgl2 = False 412 self.imagerunnermarker1 = chr(0xcd) + chr(0xca) # Markers for Canon ImageRunner printers 413 self.imagerunnermarker2 = chr(0x10) + chr(0x02) 414 self.isimagerunner = (minfile[:2] == self.imagerunnermarker1) 398 415 399 416 tags = [ lambda : None] * 256 … … 401 418 tags[ord(ESCAPE)] = self.escape 402 419 tags[ord(ASCIILIMIT)] = self.skipByte 420 tags[ord(self.imagerunnermarker1[0])] = self.handleImageRunner 403 421 404 422 self.esctags = [ lambda : None ] * 256 … … 467 485 self.logdebug("BackSides : \t\t\t%s" % self.backsides) 468 486 self.logdebug("NbBackSides : \t\t\t%i" % len(self.backsides)) 469 470 if len(self.startgfx) == len(self.endgfx) == 0 : 487 self.logdebug("IsImageRunner : \t\t\t%s" % self.isimagerunner) 488 489 if self.isimagerunner : 490 self.pagecount += 1 # ImageRunner adjustment 491 elif len(self.startgfx) == len(self.endgfx) == 0 : 471 492 if self.resets % 2 : 472 493 if nborientations == self.pagecount + 1 :