Username, Document name, page numbers etc, automatically on the page

Question: I need a stamp with the User Name and the Date on the first page

In order to demonstrate the function, ELP already provides a sample. All what is needed to do, is to mark the rule GLOBAL open the Rule assistant and set the hook at Forms management and printer handling and in the ELP_Command editor double click on the macro form: 23000.mac.

The ELP_Command is most likely: C1:1F23000; (Copy 1 Page 1 use form 23000)

Note: There is a second sample form with watermarks on every page including page and copy counter. The easiest way to look at it is to use the Quickset.

Now close all Windows and print any document using a PCL5  driver. Note for Unix., Linux implementations: Use in the ELP Command Line Arguments -p1 up to -p4 parameters.

Easiest way: As the watermark should only be used on the first page maybe a simple search and replace can do it (Saves money, as the ELP (FOR) modul is maybe not needed):

[search for a text on first page]

Search_Windows_new=Any exclusive text on first page

; found: add the watermark (See example below for PCL description) and
; EVEN more IMPORTANT read below how you do NOT need PCL knowledge at all

Add_Binary=\x1B&fS\x1B&a7000v300H\x1B&a90P\x0E\x1B)s1p8vsb4148T#ACTTIME# #USERNAME#etc.\x0F\x1B&a0P\x1B&f1S

; if it is a single document you may activate next line as well

; SEARCH_ONLY_ONCE=ON

; otherwise this could also be used on mail merge documents.

Shorter use form 23050 which is the copied file 23000.mac and changed to your needs for example with Notepad++ 

[search for a text on first page]

Search_Windows_new=Any exclusive text on first page

Add_Binary=\x1B&f23050y3X

Search_Only_Once=ON

; If the form needs to go on every page, change y3X to y4X


If you do not want to dig into PCL programming, use the next sample to create easily a form, which can be used with any ELP_Command.

[search for a text on first page]

Search_Windows_new=Any exclusive text on first page

; Add your own like below described generated form

ELP_COMMAND=C1F1000;

; or just on the first page
; ELP_COMMAND=C1:1F1000;

 

1st out of 3 methods for regular users:

 

Following steps generate an automatic page counter, which can be placed at any position on the page. If you want to use the given example, then use the provided form 25000 and continue with position 3.

  1. Design your form with the Forms & Field Installer (F&FI ) and, generate your new document, position the cursor where the watermark is needed. Then start the Word macro and select the variable type Text and add a field. Select the tributes and click on GetVariable. You may get several variables, in most cases separated by a space sign.



    Insert on that form at any place the variable: #PAGECOUNT#.
    Remember: Format it with a proportional printer font, or use the PRINT field of MS Word.
  2. Print the form using a PCL5 driver to file and convert it to a macro, using PPAdmin's Macro option. or do it direct with the F&FI Generate Macro option, Generate a form with an ID larger than 25000!
  3. Generate or enhance an ELP command, and include the form on every page. The minimum command would be <<C1F25000;D1>> in the data stream, or use PPAdmin, and alter the ini-file, like for example in the global section: ELP_COMMAND=C1F25000;D1.

As the form ID is between 25000 and 30000, the form/macro is loaded on every print page. As in this procedure the variables are inserted on file load time, the actual page number is correctly inserted.

ELP offers also ways to reset the page counter to 1, this can be done:

A) By splitting the files
B) The R - ELP_COMMAND
C) The new Escape Sequence \x1B)s-995Z 

Note: Using in section GLOBAL the key PreParsing=ON, ELP does create automatically a variable #PREPARSEPAGCOUNT# which does represent the amount of pages of the document. Unix/Linux: See -q8 ELP Command Line Argument 

 

 

2nd out of 3 methods for people with PCL know-how:

 

Here is the way to create a macro with watermarks with MS Word using the ELP variables in any printer internal font at any place in any size. In Microsoft Word, you may insert a print field and add there:

 

PRINT 27 "&fS" 27 "&a7000v300H" 27 "&a90P" 14 27 ")s1p8vsb4148T#ACTTIME#...." 15 27 "&a0P" 27 "&f1S"

Push position|

Position of the stamp----|

Rotate print direction bay 90 degrees --|

Use font Univers or Barcode*! -------------|-----------------|

Variables in ELP ------------------------------------------------------|

Stop Label printing-----------------------------------------------------------|

Rotate back to default print direction-------------------------------------------------- |

Pop cursor, so the printer cursor returns to the place where the sequence did start -------------|

* Or any other font out of the PCL font list

 

Print the document using a PCL5 driver into a file, but very IMPORTANT: Do not print through an ELP enabled queue!

Use PPAdmin Control Center  Macro tab to turn the print file into a macro, and change form call in the ELP_command.

 

 

And 3rd of 3 methods, for getting anything out of the data stream as a watermark:

Here we captures the the document name, direct out of a MS Windows data stream. (Note: Using MS Windows drivers, the document name, User Name etc. is part of the data stream initialization (See available Variables in ELP). For SAP this information can be added to the data stream by a simple DeviceType extension.)

 

For reading for example the document name out of the print file, first print the job to a file and open it for example in Notepad or better Notepad++. Check out if the needed information is part of the stream in the PJL header section. If found then add a New rule/section to the ini file and generate a new searched rule using the 3 listed keys:

 

[Global]

Variable=#DOCUMENT_NAME#:Not Found

[search rule name]

Search_Binary="Microsoft Word - "

; Usually found on the first 3 lines @PJL JOB NAME=...

StoreNextWordToVariable=#DOCUMENT_NAME#

; Read the name into a variable.

ELP_COMMAND=C1:1F2001;

; The form 2001 will be used only on the first page of the data stream, should be generated using the F&FI.
; If you first define the rules, the F&FO installer will find the variables and offer them for selection.

 

Basically when the text "Microsoft Word - " is found, usually in a PJL command, then the next word, which is the document name, is stored into the variable #DOCUMENT_NAME#. This variable is then used the macro 2001.mac.

 

Possible enhancements are:

 

A) Using this method, you can add any other application to the same section.

 

[search rule name example 2]

; MS Word

Search_Binary="Microsoft Word - "

; MS Excel (2 or more searches in one rule are OR combined)

Search_Binary="App Filename: "

StoreNextWordToVariable=#DOCUMENT_NAME#

ELP_COMMAND=C1:1F2001;

 

B) If you only want this functionality for invoice documents :

 

[search rule name example 3]

Search_binary="Microsoft Word - "

StoreNextWordToVariable=#DOCUMENT_NAME#

 

[trigger invoice]

Trigger_text="Invoice No."

ELP_COMMAND=C1:1F2001;

 

The solution works of course as well for Unix and Linux ELP, once the document name stands in the PJL section.

 

You may add in the same way the username using the predefined variable #USERNAME#, time values, page numbering etc.

 

Related articles: Rules theory, Rule assistant, Add key to rule