Changeset 220 for pkpgcounter/trunk/pdlanalyzer/escp2.py
- Timestamp:
- 07/02/05 15:41:30 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/pdlanalyzer/escp2.py
r211 r220 26 26 from pdlanalyzer import pdlparser 27 27 28 class ESCP2Parser(pdlparser.PDLParser) :28 class Parser(pdlparser.PDLParser) : 29 29 """A parser for ESC/P2 documents.""" 30 def isValid(self) : 31 """Returns 1 if data is ESC/P2, else 0.""" 32 if self.firstblock.startswith("\033@") or \ 33 self.firstblock.startswith("\033*") or \ 34 self.firstblock.startswith("\n\033@") or \ 35 self.firstblock.startswith("\0\0\0\033\1@EJL") : # ESC/P Raster ??? Seen on Stylus Photo 1284 36 if self.debug : 37 sys.stderr.write("DEBUG: Input file is in the ESC/P2 format.\n") 38 return 1 39 else : 40 return 0 41 30 42 def getJobSize(self) : 31 43 """Counts pages in an ESC/P2 document.""" … … 76 88 mustclose = 1 77 89 try : 78 parser = ESCP2Parser(infile, debug=1)90 parser = Parser(infile, debug=1) 79 91 totalsize += parser.getJobSize() 80 92 except pdlparser.PDLParserError, msg :