yes, you can use scripts as print commands.
create a new special/pseudo printer.
add "exec:/your_script_file" to the prerequisites list
select "edit command"
as "command", enter "your_script_file %filterargs %filterinput"
to the panel below "command", you can add parameters that can be configured using the printer settings dialog and that will be passed as arguments (on the right side, "format" will hold the result, e.g. "--target=%value". for type "list", the box below will list all possible options, where the "name" will replace %value above.)
For "input from", enter "< %in", for "pipe", enter "-". output will be grayed.
Now, your print job (postscript data) will be send to stdin of your_script_file.
do whatever you want with the data...
I'm rather sure you can also use a temp file as input (given by param to your script), but I can't remember how. see kdeprint help, I found the documetnation about filters there (nothing else is this).