Convert g3 faxes to ps/pdf

Chris Spencer clspence at one.net
Thu Jan 23 02:16:20 CET 2003


	Try tiff2ps.

Snippet of Python code for ya (THIS WILL NOT WORK BY ITSELF)...
def tiff2ps(infile):
	mylist=[]
	toolexe=os.path.normpath(g_BinDir+"/tiff2ps")
	try:
		tiffdata=infile.read()
	except:
		print "Unable to read input data. " 
		sys.exit(-5)
	bt=g_Temp.mktemp()
	psfile=bt+".ps"
	tifffile=bt+".tif"
	try:
		tiffout=open(tifffile,"wb")
	except:
		print "Unable to open temporary file "+tifffile
		sys.exit(-6)
	tiffout.write(tiffdata)
	tiffout.flush()
	tiffout.close()
	command=toolexe+" -p -O "+psfile+" -a "+tifffile
	l_return=os.system(command)
	print command+" returned exit code: "+`l_return`
	if l_return!=0:
		print "Could not create PostScript file."
		sys.exit(-11)
	try:
		infile=open(psfile,"rb")
	except:
		print "Unable to open PostScript file "+psfile
		sys.exit(-5)
	psdata=infile.read()
	infile.close()
	mylist.append(psdata)
	return mylist

Chris.

On Thu, 23 Jan 2003 00:56:00 GMT, jason.mangiafico at verizon.net (JM) wrote:

>quoting:
>>I am fiddling a bit with mgetty+sendfax, writing a program in Python as
>>front-end.
>>
>>These programs send and receive their faxes as g3 format, which is fine for
>>that purpose. For viewing and storing I want them as ps or pdf file! (to
>>convert between those two is trivial with ps2pdf).
>>
>>Any clue on how to convert from g3 to ps? (or where I could ask this
>>question)
>>I tried fax2ps (from libtiff-progs), doesn't work - complains that it does
>>not know the g3 file (is not a tiff file).
>>
>>I don't mind to have to use a few steps - e.g. g3 --> tiff --> ps --> pdf.
>
>
>Download the Adobe or Jaws PDF writer.  Now just print your faxes through the 
>printer driver, give it a filename, and there you have a PDF file.





More information about the Python-list mailing list