private void printfunction(string cmd)
{
string command = cmd;
// Create a buffer with the command
Byte[] buffer = new byte[command.Length];
buffer = System.Text.Encoding.ASCII.GetBytes(command);
// Use the CreateFile external functo connect to the LPT1 port
SafeFileHandle printer = CreateFile("LPT1:", FileAccess.ReadWrite, 0, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero);
// Aqui verifico se a impressora é válida
if (printer.IsInvalid == true)
{
MessageBox.Show("Printer not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
// Open the filestream to the lpt1 port and send the command
FileStream lpt1 = new FileStream(printer, FileAccess.ReadWrite);
lpt1.Write(buffer, 0, buffer.Length);
// Close the FileStream connection
lpt1.Close();
}
위의 코드 기능을 사용하여 ESC/POS 지원 EPSON TM88III 프린터로 원시 데이터를 보내 왔습니다.원시 데이터를 프린터로 전송하여 Arial 글꼴 또는 기타 글꼴로 인쇄하십시오.
프린터에는 기본적으로 글꼴이 3 개만 전송되었습니다. 그러나 ARIAL FONT에서 인쇄하는 것을 원하지 않습니다. Arial 글꼴로 어떻게 인쇄 할 수 있습니까?
Windows 인쇄 스풀러 또는 프린터 드라이버를 사용하지 마십시오. 원시 데이터를 보내서 인쇄하고 싶습니다.
어떻게 할 수 있습니까?
코딩은 Visual Studio 2008을 사용하여 C# .NET에서 코딩됩니다.
TM88은 감열지 영수증 프린터입니다. helvetica가 없습니다 : P – Blorgbeard
아, 모델 번호가 완전히 간과되어 소음에 사과드립니다. –