Sending raw data to a labelprinter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • peter.aghl@gmail.com

    Sending raw data to a labelprinter

    Hi

    I need to send some raw data to a SATO printer
    I can easily send the textstring to a laserprinter
    But the SATO does nothing
    I am almost sure that the textdata is correct (taken from another app
    which works)

    I have made a vb.net class based on this article


    I can ping the printers ip or use tracert
    But I can access the printer if I try to add a networkprinter

    I am a little puzzled :)

    Thanks in advance

    - Peter

  • Peter Lykkegaard

    #2
    Re: Sending raw data to a labelprinter

    peter.aghl wrote[color=blue]
    >
    > I need to send some raw data to a SATO printer
    > I am a little puzzled :)
    >[/color]
    The obvious: Send data via tcpip using port 9100

    Something like this (found using Google)



    rgds/Peter

    ------------------------------------------------------
    Try
    Dim iLoop As Integer
    Dim PrinterIP As Net.IPAddress

    PrinterIP = Net.IPAddress.P arse("10.1.0.18 ")

    Dim MyPrinter As New TcpClient(Print erIP.AddressFam ily)

    MyPrinter.Conne ct(PrinterIP, 9100)
    Dim stream As NetworkStream = MyPrinter.GetSt ream()
    Dim data As [Byte]()

    For iLoop = 1 To CType(Me.txtQua ntity.Text, Integer)
    data = System.Text.Enc oding.ASCII.Get Bytes("^XA")
    stream.Write(da ta, 0, data.Length)
    data = System.Text.Enc oding.ASCII.Get Bytes("^LH30,30 ")
    stream.Write(da ta, 0, data.Length)
    data = System.Text.Enc oding.ASCII.Get Bytes( _
    "^FO20,10^AD^FD " & Me.lblPOSDesc.T ext & "^FS")
    stream.Write(da ta, 0, data.Length)
    data = System.Text.Enc oding.ASCII.Get Bytes( _
    "^FO20,60^B 3^" & Me.txtUPC.Text & "^FS")
    stream.Write(da ta, 0, data.Length)
    data = System.Text.Enc oding.ASCII.Get Bytes("^XZ")
    stream.Write(da ta, 0, data.Length)
    Next
    MyPrinter.Close ()

    Catch Ex As System.Exceptio n

    Dim sMsg As String = "Error Printing New Label : " & Ex.Message
    MessageBox.Show ( _
    sMsg, "Error Printing New Label ", _
    MessageBoxButto ns.OK, _
    MessageBoxIcon. Error, _
    MessageBoxDefau ltButton.Button 1)
    End Try



    Comment

    Working...