What it does

Purpose

RPM gives you the option to run a program on your print job. What you accomplish with that is up to you.

RPM has supported the filter action since the beginning. The term "filter" comes from the Unix world and an experience configuring the Berkeley print server to process a PostScript file into HP printer codes, using Ghostscript, of course. In that situation, there was no PostScript printer available, but that was literally "no problem".

No matter how capable you make a program, you can always add to it by getting it to run the customer's own software. It's a hard combination to beat.

Setup

Credentials Optionally, select the username, password, and domain for an account with sufficient access to the destination folder. If "Interact with Desktop" is selected then Windows will attempt to match a Windows desktop with this user.

Add User Enter another set of login credentials; when the Add User dialog is closed, the user interface will attempt to validate the login to ensure valid credentials.

Interact with Desktop Select this option if your filter program requires user interaction. Note When this option is selected, the filter program will run only when the user specified in Credentials is logged on. If Credentials are not specified, this option cannot be selected.

Executable Click Browseand locate the program or batch file to be executed when print documents are received. Note Only compiled Windows programs with .com, .exe, or .bat extensions can be executed. Scripting languages such as vbscript can be run by calling the script interpreter program here.

Arguments If your program requires specific arguments enter those here. RPM provides tags which are substituted with information from the print job. See Argument substitution below.

Working directory Specifies the working directory when the program is started. The program can change its working directory during the course of operation.

Terminate idle process after X seconds Select this option only if your filter program does not terminate after it has finished processing.

Transfer file to filter using standard input The data is streamed to the filter program. Many programs with UNIX origins support standard input.

Program Output Causes the program’s standard output to be streamed to a file. This option allows you to customize the name of the file receiving the standard output.Note: Many of the save output options are limited to jobs received using the LPR/LPD protocol. If jobs are received using other methods, most of these tags will be blank

Save standard error (stderr) in working directory Select.this setting to capture anything your program might write to stderr. When the program is done, the stderr file will be removed if it's empty.

Argument substitution

RPM provides the following tags which are substituted with information from the print job. Note: Use of the tags is limited to jobs received using the LPR/LPD protocol. If jobs are received using other methods (i.e. telnet printing or drag and drop), most of these tags will be blank.

%s = name and path of the processed file containing the print stream

%f = name of the file to be processed without the path

%q = RPM queue name

%i = RPM id number

%S = RPM queue sequence number

%n = name of source file

%j = job name from control file

%t = title from control file

%b = banner from control file

%c = class from control file

%h = hostname specified by the lpr client

%u = user sent in the control file

%e = email field from control file

%S = queue sequence number

%C = control file name and path

Note: If you need any of these literal strings in your argument list, you can prevent RPM from substituting them by "escaping" the percent sign with another. For instance, if you have %%C in your argument list, RPM will not substitute it for the control file name and path but will change it to a literal %C.

Further reading

the Filter FAQ covers a range of topics related to using the filter action