![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Print Queue jobs stuck | mizzleman | HP-UX | 3 | 07-02-2008 05:52 PM |
| Print jobs getting stuck on the queue | iNetForce | SCO | 9 | 04-20-2007 05:20 PM |
| Random duplicated print jobs | Barry Staples | SCO | 1 | 03-20-2007 02:34 PM |
| jobs stalled in remote print queue | antalexi | UNIX for Advanced & Expert Users | 0 | 08-03-2004 09:07 AM |
| Deleting a batch of print jobs | orvelb | UNIX for Dummies Questions & Answers | 1 | 02-09-2001 09:20 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Catching print jobs.
Hi,
I am wondering how to catch print jobs to process them before been served to the printer. I was told that the challenge is to catch raw text that an old legacy application sends to the printer (invoices, quotes, etc) and save them as text files to allow a new application to process them doing diferent new stuff that the old app can not. We need to try this approach because there are no people that can change the legacy app's code. The client is thinking on change the app but we need to offer a solution now. Does anybody konws how to do that? Thanks in advance. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
If its your application that sends the print, you could try to disable the printer then go and fetch what is in the queue...
|
|
#3
|
|||
|
|||
|
Also, depending on the OS and queuing system used, you could write a simple printer filter as a shell script that would do the work for you. So... What OS and printing system are you on?
|
|
#4
|
|||
|
|||
|
I just know it is UNIX (don't know which one),
And I was told it uses the lpr command to print, it is all I know. Do you have a link to a tutorial o something to do that script? |
|
#5
|
|||
|
|||
|
"UNIX" can mean a lot of things.
Ok, here's what you can do, replace lpr with a script. First, find out where it lives. Let's say for example it's /usr/bin/lpr. Then replace with a script that logs how it's called and tries to copy the printer output to a file. Code:
$ su
Password:
# mv /usr/bin/lpr /usr/bin/real.lpr
cat > /usr/bin/lpr
#!/bin/sh
exec >/tmp/lpr.debug 2>&1
set +xv
echo "Lpr called on `date` with these arguments:"
echo "0:$0 1:$1 2:$2 3:$3 4:$4 5:$5 6:$6 7:$7 8:$8 9:$9"
filenames=""
args=""
while [ $# -gt 0 ]; do
case $1 in
-* ) args="$args $1" ;;
* ) filenames="$filenames $1" ;;
esac
shift
done
if [ "$filenames" = "" ]; then
filenames=/tmp/lpr.stdin
cat > /tmp/lpr.stdin
fi
cat /dev/null > /tmp/lpr.output
for f in $filenames; do
cat $f >> /tmp/lpr.output
done
exec /usr/bin/real.lpr $* < /tmp/lpr.output
exit 0
^D
# chmod 755 /usr/bin/lpr
|
|
#6
|
|||
|
|||
|
Thanks Danny,
I know that saying UNIX is not enough, but is all I have. Your answer gives me the idea of how to handle this. This project is not approved yet, but thanks to you guys I have an idea of the different things that I should take in account. |
|||
| Google The UNIX and Linux Forums |
| Tags |
| catch print job, lpr filter, print jobs, print spool, printing, unix catch printing jobs, unix print |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|