Need username printed at top of page

Helge Blischke h.blischke at srz.de
Sat Mar 17 11:48:33 PDT 2007


Patrick Young wrote:
> I was able to get the alternate pstops.c file to compile into my installation of CUPS. I added the following to my /etc/cups/lpoptions file and now I see the boxes on top and bottom of the pages:
> 
> Dest labone page-label="Username goes here"
> 
> So step 1 is working, a page-label is showing up on each page. Now how do I get the page-label to print the username of the job??? And how can I tweak the page-label text size (want it smaller) and maybe remove the bottom page-label so it's only on top? And in a perfect world, can I add a couple things to the label, like date and printer description field?
> 
> Getting closer! Thank you Helge for your help!
> --Patrick
> 
> 
>>If it's not too much trouble would you please email me the linux binary? I'll start with that. If I can't get it to work then I'll build using the full source. My email is pyoung[(at)]judgememorial[(dot)]com.
>>
>>Thank you very much!
>>--Patrick
>>
>>
>>>Patrick Young wrote:
>>>
>>>>Hello Helge,
>>>>
>>>>I found Alternate Pstops 1.93n in the Links section. Is it possible to compile that pstops.c file by itself with gcc or do I need to build CUPS from source with that file?
>>>>
>>>>If I can just use gcc, um, what's the command? Or does someone already have the alternate pstops file compiled for x86 they can send me?
>>>>
>>>>Lastly, the text file says the alternate pstops is based on CUPS 1.1.18. Will I run into problems dropping that pstops file into CUPS 1.2.7?
>>>>
>>>>Thank you very much for your help!
>>>>--Patrick
>>>>
>>>>
>>>>
>>>>>Patrick Young wrote:
>>>>>
>>>>>
>>>>>>I've googled and searched the forums. So far no suggestion has worked for me. I have Mac OS 10.4.8 clients printing via IPP to a Fedora Core 6 box running CUPS v1.2.7 (release 1.8.fc6). CUPS connects to the printers via the socket backend. I installed CUPS using Fedora's RPMs.
>>>>>>
>>>>>>I need all print jobs destined for one particular printer to have the username printed at the top of every page (for example, top left in small font). Banners before or after a print job aren't what I'm after. I'd like this to be done on the CUPS server if possible so client users can't fiddle with the setting in their accounts.
>>>>>>
>>>>>>Can anyone please guide me? I don't know Postscript or any printer languages. But I can follow detailed instructions. :-)
>>>>>>
>>>>>>Thank you for any help you can give!
>>>>>>--Patrick
>>>>>
>>>>>With the "alternate pstops filter" you may use the
>>>>>extended pae-label option in combination with a lpoptions file.
>>>>>
>>>>>Helge
>>>>>
>>>>>--
>>>>>Helge Blischke
>>>>>Softwareentwicklung
>>>>>
>>>>>H.Blischke at acm.org
>>>>
>>>>
>>>You'll need a CUPS source tarball to compile this filter;
>>>I suppose the version does not really matter (if it is greater than
>>>1.1.17).
>>>I could send you a linux binary if needed.
>>>
>>>Helge
>>>
>>>
>>>--
>>>Helge Blischke
>>>Softwareentwicklung
>>>
>>>H.Blischke at acm.org
>>
> 

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