send file to USB printer

Windows Vista
Progress 9.1E (and 10.2B)

Hi
We are having a problem with being able to send(COPY) a print file to a USB printer.

The created.txt is a print file with various control characters in it for formatting.

The program in question has the following code to send print to the Shared printer named 'hp4250' on the server named 'server'.

def var lv-spool as char format "x(50)" no-undo.
assign lv-spool = "COPY spool\created.txt \\server\hp4250".
DOS SILENT VALUE(lv-spool).

This works correctly and the file is printed.

However the print file should now be sent to a canon printer named 'canon' on my PC's USB port, with the PC named 'MIKE-PC'. (The canon printer is shared), so the code becomes
ASSIGN lv-spool = "COPY spool\created.txt \\MIKE-PC\canon".
DOS SILENT VALUE(lv-spool).

Nothing is printed.

If I remove the SILENT the DOS box says 1 file copied, but still nothing is printed.

I can print to the canon printer through word etc.

Any thoughts as to how to get round this problem.

Mike
 

Osborne

Active Member
Had the exact same problem a few years back and never really solved so ended up using "OUTPUT TO PRINTER". I think it is due to the differences in the way USB printers are connected as opposed to parallel printers.

You could try this as I seem to remember it working under Windows XP but not sure about Vista:

1. First share/create a share to the USB printer.
2. To print, you create a virtual port/capture an LPT port by using the following DOS command - NET USE LPTx \\computer\sharedPrinter - x is the LPT port number, computer is the computer name and sharedPrinter is the shared name of the printer.

Hopefully, this will work.
 
Hi Osborne,

I tried your suggested solution to create a virtual port (LPT2) with the computer name/printer name. I changed the printer properties to use LPT2, but still the same.

Regards
Mike
 

Osborne

Active Member
Seems you are having similar problems as I did. Once setting up the port does any of these work?:

OS-COMMAND SILENT VALUE("copy filename.txt LPT2:").
OS-COMMAND SILENT VALUE("COPY " + filename.txt + " " + SESSION:pRINTER-PORT).
Print /d:LPT2 filename.txt.

Don't know what else to suggest but if any help this is the Progress solution I saved at the time:

ID: P103849
Title: "how to print using DOS or OS-COMMAND with USB printer"
Created: 05/03/2005 Last Modified: 10/16/2008

Goals:
"how to print using DOS or OS-COMMAND with USB printer
"how to make a USB printer 'behave' the same way as a parallel printer in Windows

Facts:
"Windows NT 32 Intel/Windows 2000

Fixes:
A network connected and configured is needed, or install Microsoft Loopback Adapter to emulate a network.
NT4/W2K/XP based operating systems need the LPT ports to be assigned using the following methods:
- configure the USB printer as a shared resource in the network.
- Then, create a batch file and put it in the startup routine of the computer or just simply put it on the Desktop and click it after startup of the computer.
The batch file contents should have the following 2 lines of code as a minimum:
NET USE LPT1: /d
NET USE LPT1 file://computer/SharedPrinterName /persistent:yes
where:
- Computer is the computers name that has the printer
- SharedPrinterName is the printers network share name
Multiple assignments are possible as well:
NET USE LPT1: /d
NET USE LPT2: /d
NET USE LPT3: /d
NET USE LPT1 file://computer1/Printer1 /persistent:yes
NET USE LPT2 file://computer1/Printer2 /persistent:yes
NET USE LPT3 file://computer2/Printer1 /persistent:yes

Then use the USB printer in DOS or OS-COMMAND the same way as with a parallel printer.
 
Top