This function could be interesting for those, who need to generate reprints with forms and watermarks but can`t change the application from Postscript to PCL.
The trick is to convert first the print file using Ghostscript to PCL and then resend the job as PCL to the same queue. The disadvantage might be, that Ghostscript generates a graphic format, so the PCL file is not searchable or tiggerable at all. In that case the ELP commands need to be be linked to the queue, or are added at the beginning of the data stream like explained here.
Here is how to install:
-
Download the AGPL Ghostscript for your operating system, and install it. for example into the directory: c:\gs
-
Generate a file called gs.bat in the folder c:\ProgramData\WELP.
@echo off
cls
echo Convert file from %1 to %1.pcl
C:\gs\gs9.25\bin\gswin32c.exe -dNOPAUSE -dBATCH -sOutputFile=%1.pcl -q -sDEVICE=ljet4d -sPAPERSIZE=a4 %1
echo Send the %1.pcl to the same queue as a new job
copy /b %1.pcl \\%2\%3
rem delete the temp. PCL file
del /Q %1.pcl - Now setup the following convert.ini.
[Global]
; That ELP is not falling into the pass-through mode when PS files are detected
BarcodesPostScript=ON
[When a Postscript file is processed]
; If right at the beginning the PS command is found
Search_Binary=%!PS-Adobe
; Call the external batch process to convert
Call=#ELP_FORMS_PATH#gs.bat "#IN_ELP_FILENAME#" "#HOSTNAME#" "#PRINTERSHARENAME#";OFF
; and do not print at all
NoPrinting=ON
Exit=ON -
Open the printer settings and rename the printer to a name with maximum 8 characters and no Blanks!
Finally right click on the printer properties -> Share name and share the printer to exactly the same name.[ELP_Printer]
ELP_Command=K2;C2F5000H6C1;
[If it is a PS 2 PCL converted data stream]
Search_Binary=\x1BE\x1B&l26A
; using this rule, the job does not interfear with any other jobs sent and rule Global might influence the stream.
ELP_Command=K2;C2F5000H6C1;
If several different actions need to take place, then there is a trick to anyhow pass over data stream related ELP commands in a complete "ini-File" inserted at the beginning of the PCL Data stream.
This inserted inifile must exist as a standard ASCII file e.g. in the workpath folder.
\x1B%-12345X@PJL ENTER LANGUAGE=ELP
[GLOBAL]
; Make two copies
ELP_COMMAND=K2;C1F500;F2F500F300;
\x1B%-12345X
Lets name the file invoice.elp in the workpath folder.
Enhance the convert.ini like this, in order to pass over the command file names into the call command. Please add the lines to the proper section or generate the new section]
[Global]
BarcodesPostScript=ON
; just to preset the variable at beginning of the job
Variable=#IsInvoice#:" "
[Trigger for Invoice in PS Data stream]
Trigger_Binary=InvoiceNo.:
; Now set the variable to the correct file
Variable=#IsInvoice#:invoice.elp
[When a Postscript file is processed]
Search_Binary=%!PS-Adobe
Call=#ELP_FORMS_PATH#gs.bat "#IN_ELP_FILENAME#" "#HOSTNAME#" "#PRINTERSHARENAME#" #ELP_FORMS_PATH##IsInvoice#;OFF
NoPrinting=ON
Exit=ON
copy /b %4+%1.pcl \\%2\%3