Show
Ignore:
Timestamp:
09/14/08 17:22:43 (16 years ago)
Author:
jerome
Message:

Added basic support for Brother's XL2HB Page Description Language, thanks to Geovanny Junio.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/pkpgpdls/pclxl.py

    r564 r3409  
    1 # -*- coding: UTF-8 -*- 
     1# -*- coding: utf-8 -*- 
    22# 
    33# pkpgcounter : a generic Page Description Language parser 
     
    8383             
    8484    def isValid(self) :     
    85         """Returns True if data is PCLXL aka PCL6, else False.""" 
     85        """Returns True if data is HP PCLXL aka PCL6, or Brother's' XL2HB, else False.""" 
    8686        if (((self.firstblock[:128].find("\033%-12345X") != -1) and \ 
    8787             (self.firstblock.find(" HP-PCL XL;") != -1) and \ 
     
    8989              (self.firstblock.find("LANGUAGE = PCLXL") != -1)))) \ 
    9090             or ((self.firstblock.startswith(chr(0xcd)+chr(0xca)) and (self.firstblock.find(" HP-PCL XL;") != -1))) : 
     91            return True 
     92        elif (self.firstblock[:128].find("\033%-12345X") != -1) \ 
     93            and (self.firstblock.find("BROTHER XL2HB;") != -1) : 
     94            self.format = "XL2HB" 
    9195            return True 
    9296        else :     
     
    255259        """Skip the 'HP-PCL XL' statement if needed.""" 
    256260        minfile = self.minfile 
    257         if nextpos and (minfile[nextpos:nextpos+11] == " HP-PCL XL;") : 
     261        if nextpos \ 
     262           and ((minfile[nextpos:nextpos+11] == " HP-PCL XL;") \ 
     263             or (minfile[nextpos:nextpos+14] == " BROTHER XLHB;")) : 
    258264            pos = nextpos 
    259265            while minfile[pos] != '\n' : 
     
    378384            if not line : 
    379385                break 
    380             pos = line.find(" HP-PCL XL;")     
     386            pos = line.find(" HP-PCL XL;") 
     387            if pos == -1 : 
     388                pos = line.find(" BROTHER XL2HB;") 
    381389            if pos != -1 : 
    382390                found = True