Printer filter - convert to ps then to pdf

Hi,

I currently have a driver located in /etc/cups/interfaces that does the following:

job="$1"
user="$2"
title="$3"
numcopies="$4"
options="$5"
filename="$6"

# Set up printer default modes

echo -e "\033E\c"
echo -e "\033)0B\c"

cat "$filename"

So then I want to do something like the command enscript does.

enscript -p temp.ps file.txt

Then do ps2pdf

p2pdf temp.ps output.pdf

but not sure how I can include that information in the file. I also don't want it to print the file (cat "$filename")

Basically I want to end up with a print driver that when I send text and certain options it will ether:

convert to postscript then to pdf
or
convert to postsctipt then to pdf then email out the file.
or just print to a normal printer.

so i would do something like at the command line:

lp -dprinter -email /etc/hosts

Which would convert the hosts file to postscript then to pdf then email out to an address.

Is it possible?

There are txt2pdf utilities available that would skip doing the postscript step.

Under Sun Solaris mp(1) (Magic Print) will do a text to postscript conversion for you with header footer, page numbering, etc for you.

HTH

Hi,

Yes I have found similar:

enscript
ps2pdf

Which will convert the text to a postscript file then convert it to a PDF.

Now I am building the script to go with this.

I am sent a string of options which will be seperated by spaces in a variable.

What I need to do is search that variable for certian words and execute commands based on if i find that word.

For example:

The string might hold 'foo tipple'

I would want to may execute a certain command if I find 'foo' in the variable.

But also if I find 'foo' and 'tipple' I would want to execute a different command.

Basically I want to separate the initial string into multiple variables.

Maybe the awk command? NEver used it though.

Make sense?