14 if (len(sys.argv) > 6):
15 temp_in_file = sys.argv[6]
17 temp_out_handle, temp_out_fname = tempfile.mkstemp()
19 font = "-I/usr/share/cups/fonts"
20 device = "-sDEVICE=tiffg4 -dMaxStripSize=0 -r204x196 -dNOPAUSE -dBATCH -dSAFER -dPARANOIDSAFER -dSHORTERRORS -dWRITESYSTEMDICT -dGHOSTSCRIPT -sstdout=%stderr -sOutputFile=" + temp_out_fname + " " + temp_in_file
22 gs_command = "/usr/bin/gs" + " " + font + " " + device
24 exit_code = os.system(gs_command)
26 file_len = os.stat(temp_out_fname).st_size
27 if (file_len < READ_SIZE):
30 os.close(temp_out_handle)
32 out_handle = open(temp_out_fname, mode='rb')
33 while (total_bytes_read < file_len):
34 data = out_handle.read(READ_SIZE)
35 sys.stdout.write(data)
36 total_bytes_read += READ_SIZE
39 os.remove(temp_out_fname)