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 (print format)Next Topic (How to capture print page count in VB?) New Topic New Poll Post Reply
AndreaVB Forum : Printing : printing on roll paper
Poster Message
sankar_mdu2
Level: Trainee

Registered: 25-08-2004
Posts: 2

icon printing on roll paper

hi all,
i need to print a bill on a roll paper. i used printer.print method , after printing a bill ,it throws out a paper. so i need to print line by line, not page by page.

25-11-2004 at 05:53 PM
View Profile Send Email to User Show All Posts ICQ | Quote Reply
SafeHands
Level: Protégé

Registered: 19-06-2004
Posts: 5
icon Re: printing on roll paper

Hello Friend ,

          You are not able to Print Line by Line.
But You can find out page height Dyamically.

So Put the Page Height based on Number of Lines,You try to Print  

15-12-2004 at 08:52 PM
View Profile Send Email to User Show All Posts | Quote Reply
caloy
Level: Protégé

Registered: 15-03-2006
Posts: 4
icon Re: printing on roll paper

I have same problem. but i have a variable paper hieght based on the receipt that i print.... pplease help.

15-03-2006 at 05:10 AM
View Profile Send Email to User Show All Posts | Quote Reply
wen_dell
Level: Scholar

Registered: 17-01-2005
Posts: 44
icon Re: printing on roll paper

printer.print "text to print"
printer.enddoc

these two command line was proven if u install the appropriate driver of the printer. some printer worked fine on driver like LX-300 but some did not.

if u add printer.newpage on top it feeds lot of paper.

____________________________
GOD IS MY SHEPERD

28-03-2006 at 01:11 PM
View Profile Send Email to User Show All Posts | Quote Reply
ozukum
Level: Trainee

Registered: 19-04-2006
Posts: 1
icon Re: printing on roll paper

quote:
caloy wrote:
I have same problem. but i have a variable paper hieght based on the receipt that i print.... pplease help.

I found this useful piece of code in the microsoft site..... But you should have a dot matrix printer for this code to work..... Hopefully this helps

Option Explicit

      Private Type DOCINFO
          pDocName As String
          pOutputFile As String
          pDatatype As String
      End Type

      Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal _
         hPrinter As Long) As Long
      Private Declare Function EndDocPrinter Lib "winspool.drv" (ByVal _
         hPrinter As Long) As Long
      Private Declare Function EndPagePrinter Lib "winspool.drv" (ByVal _
         hPrinter As Long) As Long
      Private Declare Function OpenPrinter Lib "winspool.drv" Alias _
         "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, _
          ByVal pDefault As Long) As Long
      Private Declare Function StartDocPrinter Lib "winspool.drv" Alias _
         "StartDocPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, _
         pDocInfo As DOCINFO) As Long
      Private Declare Function StartPagePrinter Lib "winspool.drv" (ByVal _
         hPrinter As Long) As Long
      Private Declare Function WritePrinter Lib "winspool.drv" (ByVal _
         hPrinter As Long, pBuf As Any, ByVal cdBuf As Long, _
         pcWritten As Long) As Long

      Dim lhPrinter As Long

      Private Sub Command1_Click()
             Dim lReturn As Long
             Dim lpcWritten As Long
             Dim sWrittenData As String
             sWrittenData = "How's that for Magic !!!!" & vbCrLf
             lReturn = WritePrinter(lhPrinter, ByVal sWrittenData, _
                Len(sWrittenData), lpcWritten)
      End Sub

      Private Sub Form_Load()
          Dim lReturn As Long
          Dim lDoc As Long
          Dim MyDocInfo As DOCINFO

          lReturn = OpenPrinter(Printer.DeviceName, lhPrinter, 0)
          If lReturn = 0 Then
              MsgBox "The Printer Name you typed wasn't recognized."
              Exit Sub
          End If
          MyDocInfo.pDocName = "AAAAAA"
          MyDocInfo.pOutputFile = vbNullString
          MyDocInfo.pDatatype = vbNullString
          lDoc = StartDocPrinter(lhPrinter, 1, MyDocInfo)
          Call StartPagePrinter(lhPrinter)
      End Sub

      Private Sub Form_Unload(Cancel As Integer)
          Dim lReturn As Long

          lReturn = EndPagePrinter(lhPrinter)
          lReturn = EndDocPrinter(lhPrinter)
          lReturn = ClosePrinter(lhPrinter)
      End Sub
08-05-2006 at 03:32 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Printing : printing on roll paper
Previous Topic (print format)Next Topic (How to capture print page count in VB?) 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