Note : In this example i have used the recordset values.(rs(0),rs(1) etc.
Now the text file is ready.
If you print the text file directly from VB you won't get fast. So you have to print the text file from DOS prompt.
Write a printing command in a BAT file and run it from VB.
To do that
make a bat file called invprint.bat and write the following command.
type invoice.txt > prn
then save the file.
If you run the batch file from VB you will get the fast printing.
write the following code into the buttonclick event
dim fp as string
fp = Shell("invprint.bat", vbHide)
Best wishes
[Edited by Chris_871 on 14-01-2003 at 09:32 AM GMT]
06-01-2003 at 05:05 AM
|
ReaperAlex Level: Guest
Re: Dos based printing
Hi, I'm doing just this but I have an extra twist. How do I get a networked PC to print in fast mode? I can't figure how to send the data to another machines lpt port. Any ideas?
Thanks, ReapeR
13-01-2003 at 02:17 PM
|
saj Level: Guest
Re: Dos based printing
quote:ReaperAlex wrote:
Hi, I'm doing just this but I have an extra twist. How do I get a networked PC to print in fast mode? I can't figure how to send the data to another machines lpt port. Any ideas?
Thanks, ReapeR
09-03-2003 at 05:54 PM
|
saj Level: Guest
Re: Dos based printing
When printing dos based text through vb via calling shell
vbhide is used to suppress the dos screen. But when you have contnueous printing. the vbhide stays at the background which reduces the system memory and at later stage the system cannot access the batch file and the print stops. You have to then reboot the system to continue the printing jon.
Anybody knows how to clear the vbhide.
Regards
[Edited by saj on 09-03-2003 at 06:02 PM GMT]
09-03-2003 at 05:58 PM
|
saj Level: Guest
Re: Dos based printing
When printing dos based text through vb via calling shell
vbhide is used to suppress the dos screen. But when you have contnueous printing. the vbhide stays at the background which reduces the system memory and at later stage the system cannot access the batch file and the print stops. You have to then reboot the system to continue the printing job.
Anybody knows how to clear the vbhide from the memory.
Regards
09-03-2003 at 06:00 PM
|
saj Level: Guest
Re: Dos based printing
quote:Chris_871 wrote:
I too had the same problem. But I have solved with the following method.
For example, If you want to print a invoice you have to convert the invoice into text format.To do that you can use the file system object.
from project reference select Microsoft scripting runtime.
from the general declaration write the following code.
Dim fso As New FileSystemObject
Dim ts As TextStream
write the following code into any buttonclick event.
Set ts = fso.CreateTextFile(App.Path & "invoice.txt")
Note : In this example i have used the recordset values.(rs(0),rs(1) etc.
Now the text file is ready.
If you print the text file directly from VB you won't get fast. So you have to print the text file from DOS prompt.
Write a printing command in a BAT file and run it from VB.
To do that
make a bat file called invprint.bat and write the following command.
type invoice.txt > prn
then save the file.
If you run the batch file from VB you will get the fast printing.
write the following code into the buttonclick event
dim fp as string
fp = Shell("invprint.bat", vbHide)
Best wishes
[Edited by Chris_871 on 14-01-2003 at 09:32 AM GMT]
09-03-2003 at 06:03 PM
|
saj Level: Guest
Re: Dos based printing
Yes it will work
but what you will do with the vbhide. You are hiding a screen. When you have 100 invoices to be printed you have to hide the dos window 100 times which will result in stopping of printing.
How can you avoid vbhide. Is there a way to do that.
Please let me know
Regards
09-03-2003 at 06:06 PM
|
ReaperAlex Level: Guest
Re: Dos based printing
insteat of passing vbhide run the bat file 1 time, then edit the pif file to close the dos window on exit. the only draw back is the user sees the dos screen flash up then disappear. also try putting all the invoices into the same file, this works fine for me (30 invoices at a time) and i expect 100 would be fine aswell. with the old dos printers all u have to do is know how many lines each invoice needs, then when u compile the txt file making sure each invoice is teh right length, don't mess with page breaks unless u have to.
hope this helps, ReapeR
10-03-2003 at 01:19 AM
|
chiragcp Level: Guest
Re: Dos based printing
quote:rana wrote:
Hi i want to know how print dos based i.e. fast printing using vb
does it work properly on printer my setting changes while using batch file