Operating System - HP-UX
1834714 Members
2389 Online
110069 Solutions
New Discussion

How to have lp print banners on top & bottom of each page?

 
Boyd Kodama
Frequent Advisor

How to have lp print banners on top & bottom of each page?

On HP-UX 10.20, series 700's machines:

Is there a way to have the `lp` command print banners on the top and bottom on each page? The banners would be used to show the classification of the document.

Example:

####################################
# #
# U N C L A S S I F I E D #
# #
####################################

this would appear on both the top and bottom of each page.

thanks,

Boyd
Without Mondays, there weren't be any Fridays
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: How to have lp print banners on top & bottom of each page?

Hi Boyd:

One way is to put your banner into a file, for instance, called "/tmp/mybanner" and do:

# cat /tmp/mybanner /tmp/myfile /tmp/mybanner | lp -dmydest

...JRF...
John McAloon
Advisor

Re: How to have lp print banners on top & bottom of each page?

My first thought is that you are going to need a simple shell script, or perhaps awk, to put out the header, copy the number of lines out of the file to fill the balance of the page, put out the trailer, and recycle.
Bill Hassell
Honored Contributor

Re: How to have lp print banners on top & bottom of each page?

Because there are many different types of print jobs and printers, the usual suggestion modify the printer script is going to be complicated since many print jobs are not simple ASCII (ie, Postscript, enhanced PCL with fonts and graphics).

However,hen you know the file is plain ASCII with no special control characters like formfeed, you could write a wrapper that reads the file to print, outputs the top of page banner, add N lines of print text, output the end of page banner, then use formfeed to eject the page.


Bill Hassell, sysadmin
Oliver White
Occasional Advisor

Re: How to have lp print banners on top & bottom of each page?

If your printer supports PostScript, you could filter your print job through something like Enscript http://people.ssh.fi/mtr/genscript/

You can then configure your own header settings and other pretty formatting options

Re: How to have lp print banners on top & bottom of each page?

As others have noted it is easy for text files only by modifying the interface script. If you want to handle PostScript output as well, take a look at PSUtils in ftp://ftp.dcs.ed.ac.uk/pub/ajcd/psutils.tar.gz - there are utilities for resizing and combining PS files. What you'd need to do is resize the output pages to leave room for the banners and merge the output with premade banner page. Not trivial but probably not impossibly hard either.

Unwrapping PS jobs within PJL should be doable as well, but I have no idea how PCL could be handled (well, declare all PCL output classified.