Changeset 252 for pkpgcounter/trunk/pkpgpdls/postscript.py
- Timestamp:
- 09/03/05 00:40:57 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/pkpgpdls/postscript.py
r248 r252 39 39 (self.firstblock.find("LANGUAGE = Postscript") != -1))) or \ 40 40 (self.firstblock.find("%!PS-Adobe") != -1) : 41 if self.debug : 42 sys.stderr.write("DEBUG: Input file is in the PostScript format.\n") 41 self.logdebug("DEBUG: Input file is in the PostScript format.") 43 42 return 1 44 43 else : … … 47 46 def throughGhostScript(self) : 48 47 """Get the count through GhostScript, useful for non-DSC compliant PS files.""" 49 if self.debug : 50 sys.stderr.write("Internal parser sucks, using GhostScript instead...\n") 48 self.logdebug("Internal parser sucks, using GhostScript instead...") 51 49 self.infile.seek(0) 52 50 command = 'gs -sDEVICE=bbox -dNOPAUSE -dBATCH -dQUIET - 2>&1 | grep -c "%%HiResBoundingBox:" 2>/dev/null' … … 81 79 pages = {} 82 80 pages[0] = { "copies" : 1 } 81 previousline = "" 83 82 for line in self.infile.xreadlines() : 84 83 if line.startswith(r"%%Page: ") : … … 130 129 copies = page["copies"] 131 130 pagecount += (copies - 1) 132 if self.debug : 133 sys.stderr.write("%s * page #%s\n" % (copies, pnum)) 131 self.logdebug("%s * page #%s" % (copies, pnum)) 134 132 return pagecount 135 133