Re: [U2] Redirect printer to fileI forgot two of the spooler fields that are used:
$7 = line length, $8 = page length ----- Original Message ----- From: "Jerry" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Wednesday, May 09, 2007 10:40 AM Subject: Re: [U2] Redirect printer to file > Mac, > We do this type of thing all of the time. The following is one of our > printer scripts (with bogus path names). In your printer device setup use > the script that you create as the device driver. Make sure the script is > executable. > The case statement uses the form type to distribute the printout. The > first case sends the printout to a file using the banner as the filename. > Make sure you use valid system filenames in the banner, no spaces, I > advise using a date and time stamp when creating the banner so it will be > different every time. The second case is for both sending to a file and > printing to a printer in landscape 132 character mode. The third case is > for sending the file out through email using the banner as the email > address and converting the printout to a pdf document using a free program > from the internet (there are many out there, even with the same name, this > one just happened to be freeware). I used mailx on this particular system > so I could put in a return email address for bounced email but you can use > whatever is available. You will notice the fields at the top of the script > are the numbered positions of fields sent from the UniVerse spooler, these > are used to determine how to treat the printout. If the form type is empty > or not a case then the printout just prints on the printer in landscape > 132 character mode. > Jerry > > ptr.drv > > #!/usr/bin/sh > # $1 = user no, $2 = job no, $3 = bytes, $4 = banner, $5 = form, > # $6 = printer name > # > spool_file=/tmp/$1_$2 > spool_file1=/tmp/$1_$2 > spool_file2=/tmp/$2_$1 > case $5 in > TO_FILE) > spool_file=/data/ibm/REPORTS/$4 > cat - >> $spool_file > ;; > TO_FILE&PTR) > spool_file=/data/ibm/REPORTS/$4 > cat - >> $spool_file > echo "^027E^027&l1o8D^027(s16.7H" > $spool_file1 > cat $spool_file >> $spool_file1 > echo "^027E" >> $spool_file1 > cat $spool_file1 | sed 's/$/^013/' > $spool_file2 > lp -d hpptr -o nobanner $spool_file2 > ;; > MAIL) > if test $7 -lt 100 > then > cat - |/data/spool/text2pdf -c$7 -l$8 -v10 -F -s8 > $spool_file > else > if test $7 -lt 200 > then > cat - |/data/spool/text2pdf -c$7 -l$8 -v10 -F -s6 -L > > $spool_file > else > cat - |/data/spool/text2pdf -c$7 -l$8 -v8 -F -s6 -L -y1008 > > $spool_file > fi > fi > cat $spool_file | uuencode $2.pdf | mailx -r > [EMAIL PROTECTED] -s "Report from Account" $4 > ;; > *) > echo "^027E^027&l1o8D^027(s16.7H" > $spool_file1 > cat - >> $spool_file1 > echo "^027E" >> $spool_file1 > cat $spool_file1 | sed 's/$/^013/' > $spool_file2 > lp -d hpptr -o nobanner $spool_file2 > ;; > esac > > ----- Original Message ----- > From: "Mac Bhyat" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Wednesday, May 09, 2007 5:51 AM > Subject: [U2] Redirect printer to file > > >> Hi, >> >> I wonder if someone can help, I am universe for Unix, and I would like to >> setup a printer device where the output from the print is sent to a >> directory as a unique file in that directory. how do i do this with the >> uv >> spooler >> >> thanks >> >> mac >> >> >> >> >> >> >> >> Mac Bhyat >> Software Engineer - Special Projects >> Unibase Solutions (Pty) Ltd. >> >> URL: http://www.unibase.co.za <http://www.unibase.co.za/> >> Email: [EMAIL PROTECTED] >> Tel: 011 621 7000 >> Cell: 079 181 3266 >> Fax: 011 621 7029 >> >> DISCLAIMER AND CONFIDENTIALITY >> This message and any attachment contain information intended solely for >> the >> addressee which is confidential or private in nature and subject to legal >> privilege. If you receive this message in error please notify the sender >> immediately by email and thereafter delete the message and do not >> disclose >> the content in any way. Unibase Solutions (Pty) Ltd cannot assure the >> integrity of this communication, nor that it is free of errors, virus, >> interception or interference, and disclaims all liability for any such. >> Views and opinions are those of the sender unless clearly stated as being >> that of the company. The authority of the sender to bind the company >> should >> be verified by the recipient and not assumed. For contact and address >> information regarding the company please go to >> <http://www.unibase.co.za/> >> www.unibase.co.za >> -- >> This message was scanned for spam and viruses by BitDefender. >> For more information please visit http://linux.bitdefender.com/ >> ------- >> u2-users mailing list >> [email protected] >> To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list [email protected] To unsubscribe please visit http://listserver.u2ug.org/
