Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pinting question

Status
Not open for further replies.

Danielvb

Programmer
Oct 8, 2002
34
US
Hello everyone:


I am writing a program (Visual Basic 6.0) that must print a time in-out to a receipt printer (LPT1).

-- There are two pirnters (receipt printer[LPT1] and a Laser printer) connected to a PC [windows-98 operating system]

-- The Laser printer is set up as a default

I need to print the following text:

TIME KEEPER
===========

Emp-ID: JAM-0125
Date: 01/30/2003
Time-IN: 08:00:00 AM
Time-OUT: 05:00:00 PM

Here some code :
----------------

Dim fl As Long
fl = FreeFile

Open "LPT1:" For Output As #fl
Print #fl, "TIME KEEPER"
Print #fl, "==========="
Print #fl, ""
Print #fl, "Emp-ID: " & EmpID
Print #fl, "Date: " & format$(date, "mm/dd/yyyy")
Print #fl, "Time-IN: " & sTimeIN
Print #fl, "Time-OUT: " & sTimeOut
Print #fl, "-----Last Line------"
Close #fl



Questions:
==========

By only specifiying Open "LPT1:", will my code be able to send the data to the receipt printer (LPT1)?

Remember my Laser printer is setup as a default.

Any tips it will be appreciate it.

Thanks to all for your time.


Daniel
Hollywood, FL USA
 

To change the printer that your program prints to and not the default you need to ...
[tt]
Set Printer = "Printer Name"
[/tt]
So that when you use ...
[tt]
Print #fl, "Your String"
...
Printer.EndDoc
[/tt]
It will goto the printer specified.

Good Luck


 
Thanks fro reply

I have one more last question

after the printer finished printing, the program prints 8 spaces.

Question?

What command in Visual Basic 6.0 ot chr() can I used to cause the paper to be cut?

Thanks in advance for your time

Daniel
Hollywood, FL
 
You should check the printer documentation, but if it uses an ASCII code for paper cut it will probably be Chr(4) which is End of Transmission or Chr(12) which is FormFeed
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
What kind of printer are you printing to?

On the application I'm working on currently, printer.enddoc is sufficient to perform the cut.

I'm using a TelPar MTP-630, and I DON'T want an automatic cut, so I'm not going through the "Printer" object. Instead I'm sending the text followed by telpar's cut command which is

print #fl, chr(&H1D) + chr(&H56) + chr(1)

So anyway, if you can tell me your printer model I can give you the exact cut codes... I've got info on many printers available.



Tuna - It's fat free until you add the Mayo!
 
Thanks everyone for your inputs. It is very appreciate.

I will try your advices.

THIS IS FOR TheTuna:
====================

I am using an Empson Receipt Printer
TM-T88II Series
MODEL M129B

Thanks to all for your time

Daniel
Hollywood, FL
U.S.A

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top