Wrox Programmer Forums
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 19th, 2004, 10:27 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default Fast printing

Hi,

  I want to print tickets by retrieving data from the database. It will have two loops (big loops). First i want to show the print data on the screen coz each row on the paper contains two tickets.
Once the user sees the o/p on the screen and issues print command once he is sure abt the o/p.

I want to print the tickets faster coz many tickets to be printed per day. So i want to print in dos mode. How can i do this.

And, How can i show the o/p on the screen. I think in the multi line text box.


---------
Rajani

 
Old November 22nd, 2004, 01:42 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What is a o/p
Why do you need to print in DOS mode? The Printer.Print method is very fast.
It is not clear if you want to print the list in the screen or an actual 'ticket' (whatever that is)
The best way to show multi columns/rows in the screen is to use a FlexGrid or a ListView

Marco
 
Old November 22nd, 2004, 11:38 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,
 Thanx for the reply. Tickets in the sence it contains data in the form

jobcode sizecode qty layno bdlno operations

So everything is text only. Only one row(each ticket).
I displayed in the multiline textbox. From that i isued
printer.print txtResult.text

But it is printing slow. Actually that application is developed in foxpro 2.5 Now i re designed all the project in ASP. Only this printing tickets, i didn in VB thought that Printer.print is fast. But no difference.

There it is printing very fast. 1 ticket/sec
But from VB it prints 1 ticket/5 sec

So, printer is faster printer. How can i speed up printing.
Please solve my problem.

Thanx again.



 
Old November 23rd, 2004, 12:20 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Could you please try this ?

First Install the roman.fon in the machine.
After that set the font as ROMAN. Now The Print will be in DOS Mode. This worked for me once. It will depend on the particular type of printer also.
 
Old November 23rd, 2004, 01:22 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Changing font is a great idea, and it is worth a try.
Instead of hardcoding the ROMAN font in your code, you can loop through the Printer.Fonts collection until you find a font that is suitable for your application, and then using that.
Marco
 
Old November 24th, 2004, 12:00 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi madhu,
   Setting the font to Roman increased speed a bit. And, how can i print bi-directional. means, 1 row from left-to-right and next row in right-to-left direction.
Printing stops for every page. I may have 500 pages to print at a time. How can i print continuously.

  This is my code in print button click

Dim stroutput As String
Printer.TrackDefault = True
stroutput = txtResult.Text
Printer.PrintQuality = -1
Printer.FontName = "roman"
Printer.FontSize = 10
Printer.Print stroutput


Which font is good. I am expecting the problem with font. Wat is the font name if you print thru DOS mode.

-------------
Thanx



 
Old November 24th, 2004, 12:58 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Hello Rajani,

Just like macrostraf said, you can loop through all fonts in printer.fonts collection and find which one is suitable for your printer. The required font to be used depends upon the printer and how the printer is installed. The installation should support "print from MSDOS based programs" feature.

Are you not paging your printing work ? You can set the printer page size with printer.height and printer.width properties. As you print lines, you have to increment a variable and check whether the height is reached. Then you can make the printer to start on a new page with

printer.NewPage method.

PS: Printing something with printer object is a horrible thing. Data report tool or some third party tool is better.
 
Old November 24th, 2004, 05:05 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,

  I can use report tools. But they are too slow than in DOS mode. But my job is specific on speed coz everytime i may need to print 500+ tickets at a time.

Ok, i changed the printQuality to -2, font roman. Its better now.
As i am storing all the tickets in a multiline textbox initially in the same format i want to print. Coz, if the printer stops(power problem/any...) i need to print again. If i store in textbox the user can select what he needs.
And finally, how do i set vertical spacing. After each row i am inserting 4 vbcrlf to start print the next ticket. Thats is my pre printed headers on the page. But after printing some lines, the spacing is moving a bit upwards. Once its solved my problem is almost solved.


---------------
Rajani

 
Old November 24th, 2004, 09:39 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

 
Quote:
quote:And finally, how do i set vertical spacing


You can use printer.x and printer.y to set the horizontal and vertical position at which the printing starts. y increases downwards. An x value of 800 and y value of 250 will print at the top left of a page. The sample code is

printer.x=800
printer.y=250
printer.print <text to be printed>

Each ticket you can start on a new page(depending on the size of ticket).

Printer.Newpage will skip the current page and advance to the next page. You have to set the print space area also. Printer.height will help you in this case. If you set it like

printer.height=7000

This will set the height of the page to be 7000 pixels. After printing each line you can increment y value by an appropriate value (say 250 pixels). Then print the next line with the code


printer.x=800
printer.y=<new value of y>
printer.print <next line to be printed>

Also, do not forget to add printer.enddoc to finally start printing.

Hope that helps.





Similar Threads
Thread Thread Starter Forum Replies Last Post
fast connect with c# zaghmout C# 0 October 8th, 2008 02:37 AM
subform not loading fast enough MArgente Access VBA 7 July 5th, 2007 07:17 AM
Fast printing in crystal report 8.0 herry_basoya VB How-To 1 September 19th, 2006 02:31 AM
Fast XPath safin XML 4 September 15th, 2005 12:43 PM
I Need Help Guys ... Please fast :> Badie Access ASP 2 May 2nd, 2005 07:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.