Q) We need to print the last page of the document a special paper. How can ELP draw the paper form another paper tray?

As usually only the first or last pages of a document have special printing requirements, it is usually much easier to split the data stream.

The easy way to find the last page of an incoming job is to use the key PREPARSING=ON in the Global,, User-, Printer-,, driver or port named section. If the data stream is PCL5 compatible then the result of the amount of pages is stored in the variable #PREPARSEPAGECOUNT#. This variable can be used for example to draw the last page of a data stream from a different tray.



[Do Invoice]

Trigger_Binary=Invoice No.:

; Only executing for invoices


; all sheets drawn from plain paper tray, the last page from the preprinted tray.

; If somewhere for example a terms and conditions page is inserted, use in the triggered section the Counter key to increase the content of the key #PREPARSEPAGECOUNT#.


The second by far more complex way can not only find the last page, it can find any page and perform a specific ELP_Command on that page.

The theory is, that a paper tray command needs to be issued right at the beginning of the page. If this command is inserted somewhere on that specific page, the printer will feed the already printed page and print the rest form the other tray.

The 2 possible solutions are:

Solution 1: Probably not applicable

The idea is to search (if possible insert a trigger into the data stream) on top of that specific page. Search for it and replace it with the proper paper tray selection:

[Search Trigger Word]


; search for the word on top of that page, really at the beginning


; Replace it or maybe use Insert_Binary then add the command.


; Speed up a little

Solution 2: Will work any time

This solution needs two queues. The data stream arrives at queue A. This queue is only used to evaluate the command, which need to be performed and inserts it as an ELP_Command right into the data stream.

This is needed, as ELP does not cache any data which has already been processed. Therefore it is not possible to perform some actions in the data stream before the actual trigger word is found. But with the idea of 2 queues, the first queue sets the command, and the second queue performs the command.

The performance on queue B will be absolutely standard, and we don't need any ELP configuration, as the ELP_Command in the data stream will be detected, erased and of course used.

The port of queue A can be directed to any port (not file) as there will be nothing printed. However, if the driver of that queue is used, it must be a PCL5 driver.

The port of queue B must be directed to the printer. As the driver itself is not used, it even can be a generic text driver.


[Name of QUEUE A]


; Send data stream to my second queue you can also use \\#HOSTNAME#\ShareNameOfQueueB or \\\ShareNameOfQueueB


; do not print the first time the data stream is processed


; This queue uses a different ini file called QueueA.ini located in the forms directory

File QueueA .ini also in the c:\ProgramData\Welp folder

[Search for a phrase on the specific / last page]

; Use OutSearch as the page counter is only existing while processing the data and not

; during reading the data

OutSearch_Binary="Search for any phrase on the specific page"

; Add an ELP_Command into the data stream


; Draw all pages beside the one in named in #PAGECOUNTS# from plain media type drawer.

If for example this example the searched information is detected on page 5, ELP will insert <<C1I1;C1:5I9>>. C1I1; defines to draw every paper form the media tray plain except the page 5: C1:5I9; This page is drawn form media tray named PrePrinted paper.


1. You can add any additional forms or valid ELP_Commands in that command

2. As the ELP_Command will be found during the second run in the data stream, it has the highest priority. All other possible commands will be ignored

3. With this method there can only be one page treated specially.

4. If several pages should be treated specially then the ELP_Command can be setup like in the QueueA.ini like that:




; Set a dummy command that the ELP_Exit_Job is performed


; This key will add at the end of the data stream the collected ELP_Command.

[Search for the special pages]

OutSearch_Binary="Search for any phrase on the specific page"

; And if found


; Then add the special command to the already existing command string.

Note: The length of a variable is maximum 250 Bytes, the length of the ELP_Exit_Command is double the size of that, so maybe you can use different variables for different searched items.

5. If you can establish an own page counter, while reading the data stream in, then the ELP_Command can directly be generated and then activated with a trigger command.




; Default paper command


; Tell ELP to replace variables immediately in ELP_Commands, when they are set

[Search for the special marker on everypage]

Search_binary=Page no:


[Search for the special pages]

Search_binary=Invoice No:


; Add this first invoice page as an exception

Again, the last example is limited to the amount of replaces, about 40 special pages for the complete stream. Normally such things can be done pretty fast with splitting the data stream and having the benefit, that each split stream is one document.


Related articles: Rules Theory, Rule Assistant, Add key to rule