Printing through Print Server

Reply

Join Date: Jan 2009
Posts: 2
Reputation: biato is an unknown quantity at this point 
Solved Threads: 0
biato biato is offline Offline
Newbie Poster

Printing through Print Server

 
0
  #1
Jan 2nd, 2009
I'm trying to write application run as service in vb6.

I have two barcode printers (ZEBRA) with print servers connected to centronics port (D-LINK DP-301P+).
In my service i connect to SQL server and get information about destination printer and source code (ZPL) to print.
Now i must send my ZPL code to the printer.

Everything works fine when I save ZPL to file, map TCP to LPT1 and copy/print FILE to this port like this:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. net use LPT1: \\100.0.0.1\myport1
  2. copy C:\test1.txt lpt1: /b

or:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. objNetwork.AddPrinterConnection("LPT1:", "\\100.0.0.1\myport1", True)
  2. ...
  3. Open "C:\test1.txt" For Binary As #1
  4. Open "LPT1:" For Binary As #2
  5. ...

But i don't want to SAVE my ZPL code string to FILE,
i want to connect to my Print Server and Send my ZPL CODE to print.
I Need get some STATUS after operation - success or not - because i have to delete my printed label (or not) from SQL Table.
How to send data to print server? (Winsock.SendData ??)
Do i need Ascii to binary conversion or byte array?
How to check Job status?

Can someone help me?

Tom
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Printing through Print Server

 
0
  #2
Jan 2nd, 2009
Hmmm, I think the mscomm control handles both serial and parallel communications... but seeing that this is a network printer, and you are mapping it, it complicates things some. If the second code that you posted works (ie: using Open "c:\test1.txt" for Binary as #1) then why not simply save the code that you write to the file into like, a byte array (instead of the hard-drive), and then open LPT1 like you do, and just write the array in a loop or such to the printer. When you are done sending the data, just redim the byte array, and redim it again for a new ZPL.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 2
Reputation: biato is an unknown quantity at this point 
Solved Threads: 0
biato biato is offline Offline
Newbie Poster

Re: Printing through Print Server

 
0
  #3
Jan 5th, 2009
Originally Posted by Comatose View Post
Hmmm, I think the mscomm control handles both serial and parallel communications... but seeing that this is a network printer, and you are mapping it, it complicates things some. If the second code that you posted works (ie: using Open "c:\test1.txt" for Binary as #1) then why not simply save the code that you write to the file into like, a byte array (instead of the hard-drive), and then open LPT1 like you do, and just write the array in a loop or such to the printer. When you are done sending the data, just redim the byte array, and redim it again for a new ZPL.
Yes, I know, but what is the state after print (success or not)?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC