First, in what program is the "print" button ?
second, can you print to your printer right now ? (using lpr filename.ps)
You might have to make a shellscript of some sort and run that from your app instead of lpr directly. The script would then take the input print it and save it to /tmp/tmp.ps, then use ps2pdf to convert into a PDF file. and remove the temporary files. something like this
#!/bin/bash
#
# super print script
#
# read from stdin (not sure if this will work)
cat $@ > /tmp/tmp.ps
# print the file
lpr /tmp/tmp.ps
# create the pdf-file
DATE=`date`
ps2pdf "/tmp/tmp.ps" "/home/myuser/pdfs/print-$DATE.pdf"
#remove old temp file
rm -f /tmp/tmp.ps
|