How to detect if the actual page is a front / back page
Sometimes it is important to know, if the actual page is on the front or on the pack side of the paper. Here is a way how create a variable and flip between the 2 states 1 front, 2 is back page. The example is for a postscript file, where the Meta command SHP indicates a form feed (show page).
; Do not go into pass through mode for PostScript jobs
; The variable which will flip between 1 and 2
[Search for Page Break]
; increase the page side counter
; check if it is the back page + one then
TriggerSection=Page Side Counter
[Page Side Counter]
; As page 3 is a front page, move back to 1 Primary Trigger is true
; This is the real trigger we are looking for
Now further action can be done, e.g. if a duplex job need to insert an additional page, if there is a chapter break between the pages, and the last page was a front page.
Another customer case:
Q) What we need is to print on every backside of the page small form containing document number, date, current sheet number - we don't know how to count pages. All documents should be sent to the printer in simplex mode - W-ELP must change it to duplex and add the form on the back side. So we use duplex only for form printing and actually we need to count not pages, but sheets.
Version 1: If there is no UEL in the data stream (Esc%-12345X):
2. If you then would use the form as it is, the form would go onto the same page, so I suggest a small trick: Do NOT use F&FI to install directly the form, just print it to file and use the Macro register tab. On the form, where you can enter the macro ID, add in the Initialization field the printer Escape sequence : \x1B&a0G. This is the sequence for the printer to change to the next page. As ELP does only recognizing the form feed for page counting, the printer will go on the next page, but ELP does not recognize it!In other words, the variable #ACCTOTALPAGES#reflects in that case a paper sheet counting.
; On the first page turn on duplex and put the form on
; For all other pages insert only the form.
; increase page counter, so it starts with 1 and not with 0 for first page
; incrementation is done on the form feed so after the page is feed
If you need forms on the font page as well, then the F25200 must be the last one defines, like ...F1000F10100F25200;
Version 2: If there are UEL in the data stream (All Windows drivers do that):
The only small problem is the Variable # ACCTOTALPAGES# is set to 0 on every UEL, even at the beginning, as the rule GLOBAL is executed before the UEL in the data stream is found. So the counter has to be reset to 1 again with that additional rule:
[Rest Counter on UEL to 1 again]
Search_Binary=@PJL ENTER LANGUAGE
; Usually after an UEL you find this command at the end of all @PJL commands!
; Then set the counter back to 1
Related articles: Watermarks