使用内部命令控制网络打印机 [英] Control the network printer with internal commands
问题描述
您好,
我尝试通过以太网向打印机发送命令,存储卡上存有一些文件。打印机是Vario III的特定热敏打印机。这是一本内部手册: Uploadfiles.io - inter_vario3_uk.pdf [ ^ ]
问题:Connectiong可能没关系,但我不知道哪种格式或者我怎么能正确发送此打印机的功能命令。当我尝试发送如下命令时:
Hello,
I try to send command via ethernet to the printer where are stored some files on memory card. Printer is a specific thermal printer Vario III. here is a inter manual: Uploadfiles.io - inter_vario3_uk.pdf[^]
Problem: Connectiong is probably OK but I dont known which format or how can I right send a functional command for this printer. When I try to send a command like:
private void button1_Click(object sender, EventArgs e)
{
Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
clientSocket.NoDelay = true;
IPAddress ip = IPAddress.Parse("192.168.11.117");
IPEndPoint ipep = new IPEndPoint(ip, 9100);
clientSocket.Connect(ipep);
byte[] fileBytes = File.ReadAllBytes("153.874-003.lbex");
clientSocket.Send(fileBytes);
clientSocket.Close();
}
没有回复。这个命令应该根据inter手册进行更改语言,但没有任何反应。
感谢您的建议
我尝试过:
我尝试使用此程序并使用指南中的一些内部命令直接从打印机中读取数据 [ ^ ]
without response. This command should be for change language according to inter manual, but nothing happen.
Thank you for advice
What I have tried:
I try to use this program and use some internal commands from guide Reading Data Directly from the Printer[^]
推荐答案
与打印机制造商交谈,他们会比他们的设备了解更多我们会。可能是打印驱动程序妨碍了,或者您需要以某种特定方式与驱动器通信,如果没有详尽的具体品牌和型号知识,我们无法分辨 - 我们99%的人都不会甚至看过那个模型,更不用说它正是你想要做的事情。
所以跟制造商谈谈 - 他们要么得到技术支持,要么甚至可能示例代码。
Talk to the printer manufacturer, they will know a lot more about their device than we will. It may be that the print driver is getting in the way, or you need to talk to the drive in some specific manner, we can't tell without exhaustive knowledge of the specific make and model - and 99% of us are not going to have even seen that model, much less used it for exactly what you are trying to do.
So talk to the manufacturers - they will either have tech support or possibly even sample code.
Public Sub print_file(ByVal sender As Object, ByVal e As EventArgs)
'Nastavení komunikace IP ADRESA TISKÁRNY + PORT
Dim clientSocket As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
clientSocket.NoDelay = True
Dim ip As IPAddress = IPAddress.Parse("192.168.11.117")
Dim ipep As IPEndPoint = New IPEndPoint(ip, 9100)
'Otevření spojení
Try
clientSocket.Connect(ipep)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
'Načtení etikety dle ascii tabulky (SOH)FMB---rTEXTBOX1.TEXT(ETB)
Dim s As String = Assy_line_light.split_char.Text
Dim bytes = Encoding.ASCII.GetBytes(s)
Dim bytesToSend As Byte() = New Byte(7) {&H1, &H46, &H4D, &H42, &H2D, &H2D, &H2D, &H52}
Dim bytesToSend2 As Byte() = New Byte(0) {&H17}
Dim load = bytesToSend.Concat(bytes).ToArray()
Dim load2 = load.Concat(bytesToSend2).ToArray()
Try
clientSocket.Send(load2)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
'Tisk etikety dle ascii tabulky (SOH)FBC---r--------(ETB)
System.Threading.Thread.Sleep(500)
Dim print As Byte() = New Byte(15) {&H1, &H46, &H42, &H44, &H2D, &H2D, &H2D, &H53, &H2D, &H2D, &H2D, &H2D, &H2D, &H2D, &H2D, &H17}
Try
clientSocket.Send(print)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
'Uzavření spojení
clientSocket.Close()
End Sub
这篇关于使用内部命令控制网络打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!