Find here 3 different ways of how to do it, hopefully one fits your needs:
1. Last page needs to be printed always simplex on a new page (there is a bank form attached)
This and some similar examples are better described here: Perform some actions like paper tray settings on the last [or on a specific] page
The example needs page breaks with form feeds.
[GLOBAL]
; turned on, ELP will store in the variable #PREPARSEPAGECOUNT# the amount of pages
Preparsing=ON
; set first page to duplex and last page to simplex
ELP_Command=C1:1S2;C1:#PREPARSEPAGECOUNT#S0;
If the first pages are not duplex, see here.
2. Third last page and the following pages need to be printed simplex
[GLOBAL]
Preparsing=ON
[Set 3rd last page to simplex]
; Primary trigger always true in order to check secondary
Trigger_Binary=1
; If more then 3 pages then
Trigger_Variable=#PREPARSEPAGECOUNT#>3
; reduce the counter by 2, so will be the third last page then
Counter=#PREPARSEPAGECOUNT#;-2
; and print all in duplex, but the 3 last pages in simplex
ELP_Command=C1:1S2;C1:#PREPARSEPAGECOUNT#S0;
If the first pages are not duplex, see here.
3. On any page X switch back to simplex printing
Well to be absolutely independent, you may need an own page counter while reading the data stream and then set the ELP_Command according the found page number. However usually the data stream needs to have a paper tray selection in the data stream, in order to change from tray A to B.
Is this the case, then here is the easy solution:
[GLOBAL]
; Turn duplexing on page 1 on
ELP_Command=C1:1S1;
; start ELPs paper tray handler
TRAYMAP=Tray Rule
[Tray Rule]
; The last pages are drawn form paper tray with PCL5 selection number 5 (Tray 3)
; So then the tray command is changed to:
TRAY5=\x1B)s-996Z\x1B&n9WdPreprinted\x1B&l0S
; Turn ELP handling off, so the simplex command is not erased which
; would be the case as ELP_Command uses an duplex/simplex command
; change Papertray to Media type command. Set printer Tray 3 to Preprinted
; Set job to simplex
This rule set uses the paper tray switch to the form paper in order to add there the simplex command.
Related articles: Duplexing, Duplex on preprinted paper