Skip to main content

How to assign a printer to a USB port

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

How can I send to a printer connected to a USB port using the standard ASSIGN TO clause in the SELECT statement?

Resolution:

The way to print via a USB-port and not to LPT1/2 etc is to use the printer_redirection run-time tuneable.

The printer_redirection tuneable causes ASSIGN TO PRINTER statements to go to the print spooler rather than LPTn. Therefore, provided the printer attached to the USB has been installed properly there should be no problem printing to it.

There is no way to access ports directly in our product because the operating system APIs used for file handling do not handle USB port names.

To set the printer_redirection runtime tuneable you need to create a runtime configuration file and then set the run time tuneable in this file. The default filename is 'cobopt.cfg' and this is just a standard text file. However, the file can be any name of your choosing (eg; myconfig.cfg). Then, to have the runtime system access the file you need to use the COBCONFIG_   environment variable (note the underscore _     this is required). Following is an example environment variable setting:

set COBCONFIG_=C:\\test\\printer\\Redirection\\rtsconf.cfg

Once you've set the COBCONFIG_ environment variable and have it pointing to the appropriate directory/filename you then need to insert the following in the configuration file:

set printer_redirection=TRUE

NOTE: If you have ASSIGN TO LPT1 (i.e a specific port) in the SELECT statement you may need to change that to ASSIGN TO PRINTER ( i.e the system printer - which should be the printer attached to the USB port).

Old KB# 5730

0 replies

Be the first to reply!