LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Ghostscript printing (https://www.linuxquestions.org/questions/linux-software-2/ghostscript-printing-41288/)

moot 01-13-2003 05:02 AM

Ghostscript printing
 
Hi - I wanna config my PC so when I press the "print" button the machine sends a print job to the printer [on LPT1 or TCP/IP] and it automatically generates a PDF of the same output.

I think I can use Ghostscript to do this, but do not know how to script this. Anyideas please?

TIA - Moot out .....

emanuelgreisen 01-31-2003 05:05 AM

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


All times are GMT -5. The time now is 11:25 AM.