borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Convert Printout to RTF file)Next Topic (Crystal report error while instaling) New Topic New Poll Post Reply
AndreaVB Forum : Printing : printer.print problem
Poster Message
rajani
Level: Graduate

Registered: 25-11-2004
Posts: 9

icon printer.print problem

Hello,

I am printing tickets on my pre printed paper. I am generating output and storing in a text file. When the print button is clicked, the data is read from the textfile and directs to the printer. I need to count the no of lines. so, i am copying to text file. This is my code...

Dim ret As Integer
Printer.PrintQuality = -1
Printer.FontName = "draft 10cpi"
Printer.FontBold = False
Printer.FontItalic = False
Printer.FontSize = 8

ret = MsgBox("Print(Y/N)", vbYesNo)

If ret = 6 Then printcontents


Dim objfile As Object, ln As Integer, ctext As Object
Set ctext = fso.CreateTextFile("c:\tempprint.txt", True)
ctext.WriteLine txtResult.Text
ctext.Close
Set ctext = Nothing
txtResult.Text = ""
Set objfile = fso.OpenTextFile("c:\tempprint.txt", ForReading, True)
ln = 1
Do While Not objfile.AtEndOfStream
   Printer.Print objfile.ReadLine()
   Printer.Print
   Printer.Print
   Printer.Print
   ln = ln + 3
Loop

Printer.EndDoc

My problem is, vertical spacing. According to the code, i am printing 3 lines in each iteration. After printing some lines the lines are moving up/down not in the proper way. Why is this happening? I am strucked at this place. Pls help me. Its urgent.

C the link how its printing. That is my pre printed ticket and the output printed from the code.

http://m.1asphost.com/tsimsha/images/ticket.jpg

Everytime i need to print minimum >500 lines(tickets). So i need to print faster. Thats why i am using printer.print with Draft 10cpi font. I need to print continuously until the tickets are over without any interruption or interaction.
Actually this is available in foxpro 2.5. There its printing correctly. I modified the application to VB. I have this problem.

Sorry for the long problem. But i want to explain clearly.
Finally, how can i set the equal vertical spacing. And the paper width also not sufficient in VB where as in foxpro the same width but no problem.

Thax in advance

12-12-2004 at 01:52 AM
View Profile Send Email to User Show All Posts | Quote Reply
rajani
Level: Graduate

Registered: 25-11-2004
Posts: 9
icon Re: printer.print problem

Hello,

  I tried with
printer.x=0
printer.y=0
while not objfile.atendofstream
  temparr=split(objfile.readline()," ")
printer.print
temparr(0)
printer.currentx=printer.currentx+600
printer.print temparr(1)
...

printer.currenty=printer.currenty+400
wend

Still the same problem. Line spacing is changing.
And, to print a row i am dividing the string into an array and displaying at proper locations to get corect format of tickets.
Every printer.print statement displays a new line. But i want to display each line, each value at different x position.
How can i set x position.

13-12-2004 at 06:20 AM
View Profile Send Email to User Show All Posts | Quote Reply
SafeHands
Level: Protégé

Registered: 19-06-2004
Posts: 5
icon Re: printer.print problem

Hello Friend
  
       You are not set Paper Size,

Other wise
it take some Small Paper Height . printer print that height then set some gap and print next page


15-12-2004 at 09:01 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Printing : printer.print problem
Previous Topic (Convert Printout to RTF file)Next Topic (Crystal report error while instaling) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder