제브라 프린터로 인쇄를 시도합니다. 얼룩말들은 그러나 프린터Zebra 프린터 KR403 포트 번호
System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
client.Connect("127.0.0.1", 9100);
에 내가 그것을 사용할 수 이러한 포트 번호 가 없기 때문에 충돌이 코드를 실행할 때마다 연결 포트 9100을 사용 가 C#으로 나에게 표준 코드 샘플을 제공 I도 사용 텔넷 127.0.01 9100 그리고 아무 것도 듣지 않는 것을 확인했습니다. 9100 일부 Zebra 프린터에서 사용하는 포트 6101도 성공하지 못했습니다.
나는 DOS 명령
print /D:\\127.0.0.1\KR403 d:\print.txt
이 인쇄를 수행하고, 내부적 를 네트워크에 어떻게 든 수신 증명에서 실행할 수 있습니다. 이 장치는 USB 프린터이므로 정적 포트 ID를 설정하는 작업이 복잡해집니다. 아마도 이상한 명령은 바코드를 인쇄하지만 용지를 자르지는 못한다. 내가 메모장을 사용하여 인쇄 할 때 (나는 인쇄 할 때 네트워크를 사용하지 않는다고 가정합니다) 용지를 자르지 만 용지는 길이가 40cm 가량 길어집니다. 그래서 나는 드라이버와의 이음새가 있습니다.
희망은 C#을 사용하여 인쇄 명령을 보내고 ZPL 명령을 사용하여 인쇄하십시오. Microsoft는 원시 인쇄에 대한 기사도 썼지 만이 프린터에서는 실패합니다.
내가 원하는 것은이 프린터에 ZPL 지침을 보내는 것입니다.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
// print /D:\\127.0.0.1\KR403 d:\print.txt
namespace PrinterTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// Printer IP Address and communication port
string ipAddress = @"192.168.2.109";
int port = 6101; // 9100;//
// ZPL Command(s)
string ZPLString =
"^XA" +
"^FO50,50" +
"^A0N50,50" +
"^FDHello, World!^FS" +
"^XZ";
try
{
// Open connection
System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
//client.Connect(ipAddress, port);
client.Connect(ipAddress, port);
// string tmp = "\\127.0.0.1\KR403";
// client.Connect(@"\\localhost",9100);
// Write ZPL String to connection
System.IO.StreamWriter writer = new System.IO.StreamWriter(client.GetStream());
writer.Write(ZPLString);
writer.Flush();
// Close Connection
writer.Close();
client.Close();
}
catch (Exception ex)
{
MessageBox.Show("Error");
}
}
}
}
은 컴퓨터에 설치된 프린터입니까? 프린터 설정은 제어판에 연결된 포트를 표시해야합니다. –
예, 그렇지만 일반적으로 포트 nummber를 읽는다면 USB0001이 사용할 수있는 것이 아닙니다. – user613326