Specifying custom print parameters when using an RTF print program other than MS Wordviewer.
search cancel

Specifying custom print parameters when using an RTF print program other than MS Wordviewer.

book

Article ID: 52953

calendar_today

Updated On:

Products

CA Plex

Issue/Introduction

Description:

Plex users may wish to use another printing tool to force a direct printing of a report produced as a Rich Text Format (RTF) file.

This is similar to the /p option used by older versions of MS Wordviewer. However, as of Wordviewer 2007, this option is no longer supported.

In the case of a program like PRINT.EXE, in order to define a special printer (not the default printer), it is necessary to specify the name of the printer as a second parameter (i.e. PRINT.EXE "printer name").

This should mean that the [Report] section of the application ini file should be written as follows:

[Report]
Print=PRINT.EXE "printer name"

Unfortunately this does not work because Plex appends the RTF file name at the end of this string, and the final command has the wrong format for PRINT.EXE.

We need a general purpose method for specifying custom parameter formats to be supplied when triggering print programs from Plex-generated applications.

Solution:

  1. Create a new batch file called PRINT.BAT in the same folder where your Plex generated exe, dll and ini files are located.

  2. Add the batch file commands listed below to this new batch file and save it.

  3. In the [Report] section of the client ini file, change the print options as follows:

    [Report]
    ;Open is the program for previewing reports
    ;Print is the program for printing reports
    ;Open or Print can be set to "None" to stop any Plex runtime processing
    Print=PRINT.BAT
    Open=PRINT.BAT

  4. Modify the PRINT.BAT file to call the print program you are using and format the command line as required.

    The sample below shows how you could specify a printer after the RTF file name, if that's what the print program expects.

  5. Run the application and test the printing.
    *Batch file:[email protected] [email protected] The RTF file is passed in from the Plex WinC [email protected] "%1"=="" goto :[email protected] NOT "%1"=="" set RTF_FILE=%[email protected] Set the name of the program used to print the RTF file [email protected] PRINT_CMD=x:\...\Microsoft Office\OFFICE11\[email protected] Add any other parameters that the above program uses here. For example, the printer [email protected] [email protected] Format the call parameters as expected by the print [email protected]"%PRINT_CMD%" "%RTF_FILE%" %PRINTER%@:end

Environment

Release:
Component: CPLEX