Operating System - HP-UX
1846611 Members
1664 Online
110256 Solutions
New Discussion

Converting printer model script to filter

 
SOLVED
Go to solution
Bonny Jose_2
Advisor

Converting printer model script to filter

Guys, Please tell me how to convert the printer model script to filter? I want to convert the file placed through lp into printer recognised language before rlp sends it to remote LPD
Somebody please guide me
Thanks a lot
Bonny
12 REPLIES 12
Steve Steel
Honored Contributor

Re: Converting printer model script to filter

Hi


Convert the file before you send it to lp


convertfile file|lp -dxxxx

Changing printer scripts is not advised.


Anyway,what do you want to convert to what and what type of printer is it.

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Bonny Jose_2
Advisor

Re: Converting printer model script to filter

I want to convert the printjob into "printer recognised Language" because the model script I am using is "rmodel" which just rlp the job to remote LPD.
The remote printer is a Laserjet printer on a Dlink print server.
Thanks
Bonny
Leif Halvarsson_2
Honored Contributor

Re: Converting printer model script to filter

Hi,

Perhaps not a good idea to modify this scripts but if you want to try.

If you list the printer interface script you will find a line :

/usr/sbin/rlp -I$requestid $BSDC $BSDJ $BSDT $BSDi $BSD1 $BSD2 $BSD3 $BSD4 $BSDw $BSDformat $BSDh $1

try to put some lines before this line:

cat $1 | >/tmp/xyz
mv /tmp/xyz $1
Bonny Jose_2
Advisor

Re: Converting printer model script to filter

I think my question was not clear.

What I want is a filter script for this purpose.

I thought I can convert a model script into a filter script, But how?

Thanks
Bonny
Steve Steel
Honored Contributor

Re: Converting printer model script to filter

Hi


Ok try this

In the model script /etc/lp/interface/printer
============================================
Change after the shift line
===========================================
shift; shift; shift; shift; shift

#### change starts here ###############

mv $1 ${file}.tmp
/usr/lbin/lprpp < ${file}.tmp > $1

##########end of change ###############

/usr/sbin/rlp -I$requestid $BSDC $BSDJ $BSDT $BSDi $BSD1 $BSD2 $BSD3
$BSD4 $BSDw $BSDformat $BSDh $1

==============================================


Steve Steel

If you want truly to understand something, try to change it. (Kurt Lewin)
Steve Steel
Honored Contributor

Re: Converting printer model script to filter

Hi


A remote printer driver just dumps the file to the printer.

So this cannot become a filter.

Either change as shown or translate your file and then print it which is easiest


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Bill Hassell
Honored Contributor
Solution

Re: Converting printer model script to filter

Perhaps I can help. All printer scripts in the model directory are already filters. They are invoked with a specific set of command line parameters, and the standard output of the script is a slightly modified version of the file(s) used as input to the script. So in the directory /usr/lib/lp/model, pick an appropriate model script, perhaps PCL5 which handles 90% of all HP printers. Then, to filter your print file, call it like this:

/usr/lib/lp/model/PCL5 1 $(logname) MyFile 1 "-o options" /my_file_name | lp -dremote_printer

where:
$1 = 1 = requestID (noramlly assigned by lpsched)
$2 = logname = userID submiting the job
$3 = MyFile = Title..anything you want as a title
$4 = 1 = number of copies
$5 = "-o stuff" = options
$6 = /my_file_name = file to print

NOTE: each parameter must be enclosed in " " if there are imbedded spaces. So to print /etc/profile in landscape mode:

/usr/lib/lp/model/PCL5 1 $(logname) profile 1 "-olandscape" /etc/profile | lp -dremote_printer

Now the JetDirect scripts are the only ones that are being kept up to date (/usr/lib/lp/model has 90% obsolete printers) but the more recent scripts may have JetDirect-specific code. You'll have to experiment with these scripts which are found in /opt/hpnpl/sh and remove any code that doesn't allow the script to work as a simple filter. net_ljx000 is a fairly generic script for all the new HP LaserJet models.


Bill Hassell, sysadmin
Bonny Jose_2
Advisor

Re: Converting printer model script to filter

Thanks a Lot Steve, I think this is what I need. Does 'lprpp' convert the job($1) format to HP LASERJET format?

Thanks
Bonny
Steve Steel
Honored Contributor

Re: Converting printer model script to filter

Hi

http://www.lexmark.com/US/products/networking/mvp/


should work with your printer


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Bill Hassell
Honored Contributor

Re: Converting printer model script to filter

Just a followup, the -o is stripped by lpsched so your option list for the model scripts should be just the options, no -o at all). Also, the default is to print a banner page, so your option list might need something like this:

...PCL5... "landscape nb" /etc/profile ...

You can add as many options as you like:

"landscape nb duplex"

and so on...


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: Converting printer model script to filter

lprpp does not convert printer languages. It is used to take files like man pages that attempt to create BOLD print by backspacing and printing again. HP LaserJet printers are PCL which is nothing more than plain ASCII with optional escape sequences for special effects. And while a LaserJet printer can backspace, the character is still the same when placed onto the paper. So, lprpp senses the attempt to create bold from CHAR backspace CHAR by replacing the 3 characters with an escape sequence that selects the BOLD face from the current font.

It also has options to print plain ASCII files by odd or even pages and assumes the default font in the printer will generate 60 or 66 lines per page. lprpp is almost useless for anthing but simple text files and is leftover from the days of perforated greenbar paper printers.


Bill Hassell, sysadmin
Bonny Jose_2
Advisor

Re: Converting printer model script to filter

Thanks so much Bill, So if I modify the interface program /etc/lp/interface/PR3 as follows it should be alright.



shift; shift; shift; shift; shift

#### change starts here ###############

/usr/lib/lp/model/PCL5 $requestid $(logname) $1 1 $1 | /usr/sbin/rlp -I$requestid $BSDC $BSDJ $BSDT $BSD1 $BSD2 $BSD3 $BSD4 $BSDw $BSDformat $BSDh