Show
Ignore:
Timestamp:
11/28/07 11:13:33 (16 years ago)
Author:
jerome
Message:

Finally we need to duplicate some datas, since for some file formats (e.g. mstrash)
a preliminary conversion will have to be done (through wvware for example) and we
would need to overwrite original values, which is not desirable.

Files:
1 modified

Legend:

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

    r521 r522  
    3737    def isValid(self) :     
    3838        """Returns True if data is PostScript, else False.""" 
    39         if self.parent.firstblock.startswith("%!") or \ 
    40            self.parent.firstblock.startswith("\004%!") or \ 
    41            self.parent.firstblock.startswith("\033%-12345X%!PS") or \ 
    42            ((self.parent.firstblock[:128].find("\033%-12345X") != -1) and \ 
    43              ((self.parent.firstblock.find("LANGUAGE=POSTSCRIPT") != -1) or \ 
    44               (self.parent.firstblock.find("LANGUAGE = POSTSCRIPT") != -1) or \ 
    45               (self.parent.firstblock.find("LANGUAGE = Postscript") != -1))) or \ 
    46               (self.parent.firstblock.find("%!PS-Adobe") != -1) : 
     39        if self.firstblock.startswith("%!") or \ 
     40           self.firstblock.startswith("\004%!") or \ 
     41           self.firstblock.startswith("\033%-12345X%!PS") or \ 
     42           ((self.firstblock[:128].find("\033%-12345X") != -1) and \ 
     43             ((self.firstblock.find("LANGUAGE=POSTSCRIPT") != -1) or \ 
     44              (self.firstblock.find("LANGUAGE = POSTSCRIPT") != -1) or \ 
     45              (self.firstblock.find("LANGUAGE = Postscript") != -1))) or \ 
     46              (self.firstblock.find("%!PS-Adobe") != -1) : 
    4747            self.logdebug("DEBUG: Input file is in the PostScript format.") 
    4848            return True 
     
    5353        """Get the count through GhostScript, useful for non-DSC compliant PS files.""" 
    5454        self.logdebug("Internal parser sucks, using GhostScript instead...") 
    55         infname = self.parent.filename 
     55        infname = self.filename 
    5656        command = 'gs -sDEVICE=bbox -dPARANOIDSAFER -dNOPAUSE -dBATCH -dQUIET "%(infname)s" 2>&1 | grep -c "%%HiResBoundingBox:" 2>/dev/null' 
    5757        pagecount = 0