USB Printing

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

USB Printing

Post by serge_girard »

Hello,

Does anybody know how to print directly to a POS USB printer? I now have an old paraller POS printer which prints immdetialy after:

Code: Select all

SET DEVICE  TO PRINTER
SET PRINTER ON
SET CONSOLE OFF
? 'lines'
SET PRINTER OFF
SET PRINTER TO
SET DEVICE  TO SCREEN
SET CONSOLE ON
Thanks, Serge
There's nothing you can do that can't be done...
User avatar
quartz565
Posts: 667
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

Re: USB Printing

Post by quartz565 »

Check out this:
viewtopic.php?f=6&t=4131
Best Regards,
Nikos.

os: Windows Server 2019 - 64
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: USB Printing

Post by serge_girard »

Thx Nikos, I will have a look at it!
There's nothing you can do that can't be done...
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: USB Printing

Post by mol »

Hi Serge.
Do you connect this printer via USB-Centronics adapter?
You can set your printer as shared, then you can map it to lpt

eg.
net use lpt1 \\comp_name\shared_printer_name

After that, you can use your commands as you described
Last edited by mol on Thu May 04, 2017 4:47 am, edited 1 time in total.
franco
Posts: 820
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: USB Printing

Post by franco »

Serge, I have printed to usb or network printers for many years.
To do so I always made a batch file to start my exe program. This way you can print to local or printers on the network.
You install the windows printer. then share it, I use a simple share name .. like star1. This is easier to set up.
If you are not printing to a local printer the computer you are printing to should be on same workgroup.
If you are printing local, you need your computer name and printer share name.
Here is eg: of batch file
myprogram.bat
echo off
cls
net use lpt1: \\mycomputername\star1 //set printer to lpt1 You can set any port.
myprogram.exe // prints to port instead of printer. Then all print commands can go to lpt1: not images text only.
net use lpt1: /delete // I always shut of link after program
//end batch file

At start of print procedures say set device to printer then
set printer to lpt1

then all print commands @ line,col say commands go to printer
I usually print some blank lines at end of print to set start of next printout
at end say set device to screen.
I hope this is what you where looking for.
Franco
All The Best,
Franco
Canada
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: USB Printing

Post by serge_girard »

Thanks Franco, Marek and Nikos!

I think use net use in my start-batch file will be best solution: no changes in my programs!

I will try as soon as I have the printer.

Thanks again,

Serge
There's nothing you can do that can't be done...
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: USB Printing

Post by serge_girard »

Franco, Marek,

When using NETUSE.. I must share the printer with a short name (which I did). Is it also necessary to change port from USB001 to LPT1?

Serge
There's nothing you can do that can't be done...
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: USB Printing

Post by mol »

No,printer pirt should be usb.
Network mapping does the job.
Which windows version do you have?
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: USB Printing

Post by serge_girard »

W10-32 + W10-64 + W7-32
Printer has not yet arrived so I can not start testing. I let you know, thanks Marek!

Serge
There's nothing you can do that can't be done...
Post Reply