[Samba] Re: LPRng: Putting a stamp on all printed sheet

Joel Hammer Joel at HammersHome.com
Mon Jul 1 17:54:02 GMT 2002

Here is a an encapsulated postscript file and some raw, generic postscript
commands to precede and follow the EPS file which puts a message on
the page.

I have tried this out on two postscript files and it works.

NOW, you will have to generate this file for each print job with the
appropriate parameters, including, I suppose, the right bounding box,
the right location of the text, maybe change the fonts, get the user
name and date and stuff. You will have to put this code on every page of
your print jobs if you want it on every page. Of course, you can embellish
this, and use fancy underlays and the like.

The user name will be found with the set command in your printing
shell. The printer name should be a constant, and date can be generated
from the date command. Obviously, there are a lot of details to polish.

Put this file after the Page: directive(s) in your postscript files,
as illustrated below.

If this meets your needs, and want to go with this, (I mean, you must
have plenty of spare time, right?) but are having trouble with some of
the details, let me know.

BTW, I am a total amateur. If this chokes your entire enterprise and they
fire you, well, sorry, but this software comes with no warranty!  

BTW, I got this almost straight out of:
Encapsulated PostScript File Format Specification
Version 3.0
1 May 1992
Adobe Developer Support
Page 27.

The only thing I have done is to put all the code which is supposed to
precede and follow the eps file together with the eps file, so the whole
hunk of code can be put where it needs to be. That way, since I don't know
much about postscript, all I have to find is where the Page: directive is
and put it there. I have no idea if this is proper or not but it seems to


%%Page: 2 2  <----This is the insert point in your postscript document.
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 4 4 608 407
%%Title: (YourTitle)
%%CreationDate: (10/17/89) (5:04 PM)
/b4_Inc_state save def% Save state for cleanup
/dict_count countdictstack def
/op_count count 1 sub def % Count objects on op stack
userdict begin % Make userdict current dict
/showpage { } def % Redefine showpage to be null
/Courier findfont 12 scalefont setfont
60 60 moveto
(This is my message) show  <----This is the line to change for user/date/printer
count op_count sub {pop} repeat
% Clean up dict stack
countdictstack dict_count sub {end} repeat
b4_Inc_state restore
save restore
% End of insertion

On Mon, Jul 01, 2002 at i06:23:19PM +0200, Roger Brel wrote:
> Hi Joel,
> First, I thank you for having made an answer at my E-mail.
> I am agree with you for adding , either a PostScript function in the
> original PostScript document (with an underlay, easy generated by a2ps
> --underlay) , or merge on each page a PostScript definition with a stamp
> .
> In all these cases, I don't know who I can practice ?
> The other possibility is altering the before sending to a spooler. But
> the variety of software are very important, end the list is too long to
> send you.
> In fact, I read the "LISA98 Printing and Network Print Soolers" tutorial
> , and inside of this (page 44) I see :
> 	PS fixer (psmoreutils2.tar.gz)
> 	merges pages of two documents, good for putting a background on a
> document.
> But I seems me that I has not made a test with an EPS document. I try
> it.
> 1 - convert some files with ps2eps
> 2 - try to use psmerge command for adding my stamp
> Thanks.
> Roger.
> Joel Hammer wrote:
> > 
> > I am no expert on either lpng or postscript.
> > I don't know of an easy solution, but one may exist.
> > However, this sounds like a postscript question, not an lprng
> > question. The ideal solution would be to have your filter edit the
> > postscript job and put this information into an underlay. Without spending
> > any of my time on it, if no one can give you an easy solution, I would
> > look into the possibility of generating an encapsulated postscript file
> > with this information in it and inserting that into each page of the
> > document to generate the desired output when printing.
> > 
> > Another possibility is altering the files at the time they are generated. How
> > are these postscript files being generated.?
> > 
> > If these postscript files are all being generated "in house" with the same
> > software, you might be able to just insert the raw postscript code into each
> > document to get the desired result.
> > 
> > Joel
> > 
> > On Mon, Jul 01, 2002 at 09:10:10AM +0200, Roger Brel wrote:
> > >
> > > You're welcome,
> > >
> > >
> > > I work on Solaris 5.8 (sparc), use LPRng and ifhp for spooling all my
> > > jobs.
> > >
> > > I wish to use a filter for stamping all printed sheet with $USER , $DATE
> > > and
> > > $PRINTER_NAME on header or footer or underlay.
> > > The problem is that this filter must be applied on all PostScript jobs.
> > >
> > > Do you know if there are a solution for solving my problem ?
> > >
> > > Roger. (roger.brel at cea.fr)
> > >
> > -----------------------------------------------------------------------------

More information about the samba mailing list