35 | | enscript = 'enscript --quiet --portrait --no-header --columns 1 --output - | gs -sDEVICE=tiff24nc -dPARANOIDSAFER -dNOPAUSE -dBATCH -dQUIET -r%(dpi)i -sOutputFile="%(fname)s" -' |
36 | | a2ps = 'a2ps --borders 0 --quiet --portrait --no-header --columns 1 --output - | gs -sDEVICE=tiff24nc -dPARANOIDSAFER -dNOPAUSE -dBATCH -dQUIET -r%(dpi)i -sOutputFile="%(fname)s" -' |
37 | | def __init__(self, infile, debug=0, firstblock=None, lastblock=None) : |
38 | | """Initialize the plain text parser.""" |
39 | | pdlparser.PDLParser.__init__(self, infile, debug, firstblock, lastblock) |
40 | | |
41 | | # Tries to detect is a plain text to PostScript command line tool is available |
42 | | # and use the first one we find. |
43 | | paths = os.environ.get("PATH", "/usr/local/bin:/usr/bin:/bin").split(os.pathsep) |
44 | | for cmd in ("enscript", "a2ps") : |
45 | | for path in paths : |
46 | | if os.path.exists(os.path.join(path, cmd)) : |
47 | | self.totiffcommand = getattr(self, cmd) |
48 | | return |
49 | | |
| 35 | totiffcommands = [ 'enscript --quiet --portrait --no-header --columns 1 --output - | gs -sDEVICE=tiff24nc -dPARANOIDSAFER -dNOPAUSE -dBATCH -dQUIET -r%(dpi)i -sOutputFile="%(fname)s" -', |
| 36 | 'a2ps --borders 0 --quiet --portrait --no-header --columns 1 --output - | gs -sDEVICE=tiff24nc -dPARANOIDSAFER -dNOPAUSE -dBATCH -dQUIET -r%(dpi)i -sOutputFile="%(fname)s" -', |
| 37 | ] |