wheelibin
asked on
How to print direclty to print server (zebra ZPL code) from vb6
The printer is a Zebra z4m, and I'm trying to print a file containing ZPL (zebra programming lang)
I have an existing print solution with the printer directly connected via LPT1, the code I'm using for this works perfectly:
-------working code----------
Open "c:\tropos\sdk\label" For Input As #1
Open "lpt1" For Output As #2
strTMP = Input(LOF(1), #1)
Print #2, strTMP
-------------------------- ------
The problem occurs when I want to put the printer on a network print server (D-Link DP-301p).
I've tried mapping lpt1 to the print server (net use lpt1: \\...etc) and using the same code as above but it fails (shows Error-printing in XP)
I've also tried using the printer object in vb i.e.:
Open "c:\tropos\sdk\label" For Input As #1
strTMP = Input(LOF(1), #1)
printer.print strtmp
printer.enddoc
but it still just comes up with an error straight away.
I've also tried setting the printer port to lpr printing as well as tcp/ip.
Now I'm truly stuck!
Any ideas anyone??
Jon
I have an existing print solution with the printer directly connected via LPT1, the code I'm using for this works perfectly:
-------working code----------
Open "c:\tropos\sdk\label" For Input As #1
Open "lpt1" For Output As #2
strTMP = Input(LOF(1), #1)
Print #2, strTMP
--------------------------
The problem occurs when I want to put the printer on a network print server (D-Link DP-301p).
I've tried mapping lpt1 to the print server (net use lpt1: \\...etc) and using the same code as above but it fails (shows Error-printing in XP)
I've also tried using the printer object in vb i.e.:
Open "c:\tropos\sdk\label" For Input As #1
strTMP = Input(LOF(1), #1)
printer.print strtmp
printer.enddoc
but it still just comes up with an error straight away.
I've also tried setting the printer port to lpr printing as well as tcp/ip.
Now I'm truly stuck!
Any ideas anyone??
Jon
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
PocketMatt:
Good shot! That worked a treat, I may try and use the API calls too but for now the copying is good enough for me.
Cheers for the speedy answer :)
Good shot! That worked a treat, I may try and use the API calls too but for now the copying is good enough for me.
Cheers for the speedy answer :)
To send printer commands in windows driver, I now use JOE Hecht's rawprint.pas
There is a link to it here:
http://www.efg2.com/Lab/Library/Delphi/Printing/
look for item "Raw" printer access
It enables me to control the printer directly using windows drivers.
So, setup a windows printer driver (use generic type) and map it to the printserver queue.
Then send your printer commands to the driver using rawprint.
Remember to set the printer as default or use this command to set it,
Printer.PrinterIndex:=n;
where n is the printer driver number.