Operating System - HP-UX
1822909 Members
3857 Online
109645 Solutions
New Discussion юеВ

Printing headers and footers in UNIX

 
SOLVED
Go to solution
Theresa Patrie
Regular Advisor

Printing headers and footers in UNIX

Hi, Is there any way to add headers/footers to all printouts on HP-UX 10.20. We need to add a classification to all pages of all documents for security reasons.
Thanks!
Theresa
This is my easy job!
5 REPLIES 5
Peter Kloetgen
Esteemed Contributor

Re: Printing headers and footers in UNIX

Hi Theresa,

if I understand your posting the right way, you can use awk:

awk 'BEGIN {print "whatever_you_want"} {print $0} END {print "whatever_you_want"}' /dir/file
> /dir/"changed_file"

This would print "whatever_you_want" before printing the rest of the file, after printing the contents of the file it would print "whatever_you_want". The output would be redirected into the /dir/changed_file.

Allways stay on the bright side of life!

Peter

I'm learning here as well as helping
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Printing headers and footers in UNIX

Your least evil option is to send all lp activity through the pr command. It has options for setting these as well as page length. Man pr for details. Your other option is to put a filter inside each interface file but this will involve knowing the page length of each print job.
If it ain't broke, I can fix that.
Theresa Patrie
Regular Advisor

Re: Printing headers and footers in UNIX

Hi Clay,
The "pr" option sounds like the best road to take. To implement that, I would create my own lp script that piped lp to pr?? Would there be a way to have the user put in what they wanted the header/footer to be?? It would have to be configurable because each document will have a different classification. I suppose I could have different printer names depending on the classification needed and just wrap them with the correct headers embedded in my scripts. Okay, now I am rambling...what do you think?
Thanks,
Theres
This is my easy job!
A. Clay Stephenson
Acclaimed Contributor

Re: Printing headers and footers in UNIX

Hi again,

There is a problem with pr in that you have limited control over the footer. If you output is to HP Laserjet's or compatibles, let me suggest one other alternative. Check out a product called Unform. http://www.unform.com

This will supply you with enough intelligence to handle almost any situtation and can be simply incorporated into each of your interface scripts.

This is not a simple task and if you don't use Unform, some fairly complex Perl or awk is going to be required to preprocess your files before sending them to lp. You will generally have to do things to condense the print so that the normal 66 lines will print and still allow for the header and footer on each page. That is something that a simple BEGIN/END awk block can't do.

If I were doing this, I would look hard at UnForm because it's the one possible solution that would be adaptive enough to handle whatever input stream you send it and also let you 'fit to page'.
If it ain't broke, I can fix that.
Theresa Patrie
Regular Advisor

Re: Printing headers and footers in UNIX

Thank you both for your input. I'll have to look into the cost of unform so see if it is an option. Since we have $0 in our purchasing budget for this, I may have to explore other options. I could live without the footer and may be able to work through it with just a header requirement. Thanks again!
Theresa
This is my easy job!