Changeset 1673

Show
Ignore:
Timestamp:
08/09/04 20:14:22 (20 years ago)
Author:
jalet
Message:

Added workaround for number of copies and some PostScript? drivers

Location:
pykota/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/NEWS

    r1671 r1673  
    2424    - 1.20alpha1 :  
    2525     
     26        - Added workaround for number of copies directly set in 
     27          PostScript code. 
     28           
    2629        - Added german translation. 
    2730         
  • pykota/trunk/pykota/pdlanalyzer.py

    r1622 r1673  
    2222# 
    2323# $Log$ 
     24# Revision 1.27  2004/08/09 18:14:22  jalet 
     25# Added workaround for number of copies and some PostScript drivers 
     26# 
    2427# Revision 1.26  2004/07/22 13:49:51  jalet 
    2528# Added support for binary PostScript through GhostScript if native DSC 
     
    131134        """Initialize PostScript Analyzer.""" 
    132135        self.infile = infile 
     136        self.copies = 1 
    133137        
    134138    def throughGhostScript(self) : 
     
    158162        except OSError, msg :     
    159163            raise PDLAnalyzerError, "Problem during analysis of Binary PostScript document." 
    160         return pagecount 
     164        return pagecount * self.copies 
    161165         
    162166    def natively(self) : 
     
    167171            if line.startswith("%%Page: ") : 
    168172                pagecount += 1 
    169         return pagecount 
     173            elif line.startswith("%%BeginNonPPDFeature: NumCopies ") : 
     174                # handle # of copies set by some Windows printer driver 
     175                try : 
     176                    number = int(line.strip().split()[2]) 
     177                except :      
     178                    pass 
     179                else :     
     180                    if number > 1 : 
     181                        self.copies = number 
     182            elif line.startswith("1 dict dup /NumCopies ") : 
     183                # handle # of copies set by mozilla/kprinter 
     184                try : 
     185                    number = int(line.strip().split()[4]) 
     186                except :      
     187                    pass 
     188                else :     
     189                    if number > 1 : 
     190                        self.copies = number 
     191        return pagecount * self.copies 
    170192         
    171193    def getJobSize(self) :