Need username printed at top of page
Patrick Young
pyoung at judgememorial.com
Mon Mar 19 23:35:21 PDT 2007
Things are going well. Thank you, Helge! Now I just have a couple PostScript questions. I added (Username: ) show before _WM_str show and (, Job ID: ) show after it. It prints Username: somename, Job ID: so I haven't blown things up yet. I tried making a call to the job-id variable but couldn't get it to work. How do I do that. Also, now the text begins in the center but moves towards the right side of page. How can it be truly centered again after I added those extra lines?
Thank you!
--Patrick
> Create a directory
> $CUPS_DATADIR/watermarks
> (The environment variable CUPS_DATADIR usually is /usr/share/cups
> or /usr/local/share/cups, depending on your installation)
> and put the following PostScript routine there
> ---snip---
> %%BeginFile: label_user 1.0 0
>
> userdict begin
> /CUPS_label_user where
> {pop}
> { % first call: do necessary initialisations
> currentglobal true setglobal
> globaldict begin
> /CUPS_label_user true def % say not yet called
> end
> setglobal
>
> % Define the BeginPage stuff to render the watermark to appear
> % beneath the contents of every page
> <<
> /BeginPage
> {
> pop
> gsave
> % job-originating-user-name contains the user name you want to put onto
> % the bottom of the page
> /_WM_str CUPS_ENV_OPT/job-originating-user-name get dup length string
> copy def
> % Instead of Courier, use any font you know is resident on the printer
> % the first 12 is the horizontal, the second the vertical scale factor
> % in printers points (1/72 inch)
> /Courier [12 0 0 12 0 0] selectfont
> 0 setgray % assuming the user name is to be written in black
> currentpagedevice/PageSize get aload pop % pagewidth pageheight
> pop % don't need this
> % the username will be written 20 points above the lower paper edge and
> % horizontally centered
> newpath
> _WM_str stringwidth pop sub 2 div 20 moveto
> _WM_str show
> grestore
> }bind
> >>setpagedevice
>
> }ifelse
>
>
> end %userdict
>
> %%EndFile
> ---snip---
> and name it, e.g. "User_goes_here".
>
> Then, with the option
> page-label=User_goes_here
> the name of the user requesting the job will be printed
> near the bottom of the page (see the comments in the PostScript
> snippet, that are the strings beginning with a percent sign.
>
> Feel free to ask if you have more queestions.
>
> Helge
>
>
>
> --
> Helge Blischke
> Softwareentwicklung
>
> H.Blischke at acm.org
More information about the cups
mailing list