> From [EMAIL PROTECTED] Fri Jul 14 07:01:06 2000
> Date: Fri, 14 Jul 2000 14:46:46 +0200 (CEST)
> From: Jesper Dangaard Brouer <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: LPRng: Problem with ifhp with respecting the "ps_eoj_at_start@"
>
> Hi Patrick
>
> On Thu, 13 Jul 2000 [EMAIL PROTECTED] wrote:
>
> > > > I am a little puzzled why this is making a difference.
> > >
> > > Okay, my hack/trick is that I want a "bannerline", please note "line" not
> > > "page" (as in bannerpage).
> > >
> > > I have written some postscript-code which makes an bannerline on each page
> > > (see attachment: bannerpage.ps)
> > >
> > > My "old" printer system, were sending the print job as one ps-file,
> > > generated through our own filter. Now I want to upgrade to ifhp (it is
> > > much cleaner and better than our own filter).
> > >
> > > But bannerpage with ifhp, is done in 2 stages ...!
> > > ("of" prints the bannerpage, "if" prints the "real" job)
> > > That is 2 seperate print jobs, which means that my postscript code from
> > > the bannerpage.ps does NOT have any effekt on the second job.
> > >
> > > What I'm doing is in the above (in my printcap file), is to make sure that
> > > nothing happens between the 2 filters "of" and "if", so that my bannerline
> > > postscript code doesn't get "deleted", but survives in the printer.
> > 
> > Well,  I have a solution but you will not like it.  I think.
>
> I have solved the problem exactly this way ;-) And was about to answer my
> own mail with this solution ;-)
>
> So I like it!
>  
> > First,  if I get this straight,  you want to
> > 
> > a) send some PostScript at the start of each PostScript file
> Yes, I want to set a postscript "hock" on /Endpage (attaching it to the
> pagedevice mekanism), which means that it gets activated on every page
> (and prints my bannerline).
>
> > b) have this PostScript 'configured' for each user.
> Yes, I just didn't realize that the information was available in the
> ifhp.conf, until I saw the "pjl_ready_msg" syntax.
>
> > Suppose that we append the following to the ifhp.conf file:
> > 
> > [ hp5simx ]
> > tc=hp5simx
> > 
> > ps_bannerline= 
> >  20 dict begin
> >  /bline true def
> >  /user (\%s{n}) def
> >  /job (\%s{J}) def
> >  /file (\%s{f}) def
> >  /host (\%s{H}) def
> >  /date (\%s{D}) def
> >  /printer (\s%{P}) def
> >  %
> >  % Bannerpage and bannerline postscript code
> >  %
> >  /mm { 25.4 div 72 mul } def
> >  /ef1 /Helvetica findfont [9 0 0 6 0 0] makefont def
> >  /ef2 /Courier   findfont [9 0 0 6 0 0] makefont def
> >  bline { %if
> >    /mbline {
> >      gsave
> >      initgraphics
> >      90 rotate
> >      //ef1 setfont  32 //mm exec -8 //mm exec moveto (User: ) show
> >       //ef2 setfont //user show
> >      //ef1 setfont 112 //mm exec -8 //mm exec moveto (File: ) show
> >       //ef2 setfont //file show
> >      //ef1 setfont 192 //mm exec -8 //mm exec moveto (Date: ) show
> >       //ef2 setfont //date show
> >      //ef2 setfont 112 //mm exec -6 //mm exec moveto (Printed at ) show
> >       //ef1 setfont (DIKU) show
> >      grestore
> >    } bind def
> >  } { /mbline { } def } ifelse
> >  << /EndPage { 2 ne dup { //mbline exec } if exch pop } bind >> setpagedevice
> >  end
> > ps_init+=[ bannerline ]
> > 
> > 
> > Now we use the same setup as before:
> > ...
>
> Now I just want the students (users) to be able to choose between
> bannerline and no bannerline ... but this should be easy to solve ;-)

Then change:
   ps_init+=[ bannerline ]
TO
   ps_user_opts+=[ bannerline ]

and now they can do:  lpr -Zbannerline

>
> The only thing which bugs me is \%s{D}, which is the "date". I would like
> an more pretty output ... is there any way I can do this? (eg. specifying 
> my own parameters/variables \%s{pretty_date_format})

Not really easily.

You would have to modify ifhp.c:

char *Find_sub_value( int c, char *id, int strval )
{
    char *s = 0; 
    int i;
    DEBUG4("Find_sub_value: type '%c', id '%s'", c, id );
    if( s == 0 && !strcasecmp(id,"pid") ){
        static char pid[32];
        SNPRINTF(pid, sizeof(pid),"%d",getpid());
        s = pid;
    }
    /* pretty date */
    if( s == 0 && !strcasecmp(id,"date") ){
        static char date[64];
                struct tm tm;
                gettimeofday(&tm);
        strftime(date, sizeof(date),"format for date",&tm);
        s = date;
    }


Now change

  /date (\%s{D}) def
TO
  /date (\%s{date}) def

and you will have what you want.

Of course you could even go further and use:

ifhp.conf file:

date_format= .... format for strftime ...

    /* pretty date */
    if( s == 0 && !strcasecmp(id,"date") ){
        static char date[64];
                char *fmt = Find_str_value(&Model,"date_format");
                struct tm tm;
                if( date_format ){
                        gettimeofday(&tm);
                        strftime(date, sizeof(date),Date_format,&tm);
                        s = date;
                } else {
                        id = "D";
                }
    }


But I digress again.

>
>
> Thank you for your answer :-)
>
> Hilsen
>   Jesper Brouer


Well, you have the code there... :-)

-----------------------------------------------------------------------------
If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to