If you want to do some filtering or special processing while (or in lieu of) printing, you can do that on the PC (AshLPD server) side by specifying a COMMAND in the AshLPD printer definition file. As one example, let's say that the print files on the application server are hard coded for a PCL printer, but you want to be able to print them via AshLPD to a Windows-only ink jet printer. To do this effectively, you will need to strip out the PCL code. To do this, you could implement a printing SBX, let's say called FILTER, that you insert into the printer definition file on the PC side as follows:
;<AshLPD printer definition>
COMMAND = SBX:FILTER
DEVICE = Cheap Ink Jet | \\pserver\cheapjet
When the application sends one of these files to be printed, it would first be transferred to the AshLPD workstation, where it would be passed to the FILTER.SBX file which could strip out the PCL code (and even replace it with corresponding GDI commands), before sending it to the cheap ink jet printer.
As another example, let's say you want to email copies of all reports going to a certain printer. On the application server side, you would set up a printer init file something like this:
;<application server printer definition for emailing>
COMMAND = SBX:ASHLPR,1
DEVICE = prt1
The ,1 in the COMMAND statement above causes the print file to be sent to the print queue defined by the DEVICE statement, in addition to being sent to the AshLPD server. On the AshLPD side, the matching printer init file would have to use a different SBX to reformat the file for emailing. For interactive emailing, you could use the ready-made EMAILP.SBX, as follows:
;<AshLPD printer definition for interactive emailing>
COMMAND = SBX:EMAILP
Otherwise, for program-controlled email, you could write your own filter SBX, perhaps making use of the EMAILX.SBX routine, e.g.:
;<AshLPD printer definition for program-controlled emailing>
;(note: EMAILZ.SBX to be custom written, using EMAILX.SBX?)
COMMAND = SBX:EMAILZ
A third example might be where you just want to make a PC-based copy of all files sent to a particular printer (without printing at all). To do this, just use the pseudo device DISK:<path>, e.g.:
;<AshLPD printer definition to just store a copy>
PRINTER = DISK:c:\print-archives
Note that the above printer AshLPD printer definition, in conjunction with the standard ASHLPR printer init file on the application server side, essentially turns the PRINT command into a file transfer command. That is, the application server command:
PRINT <printer>=<file>
Would just copy <file> from the application server to c:\print-archives\<file> on the PC (and also log it to the OPR:ASHLPD.LOG file.)