하지만 그 여전히 솔루션, 내가 무엇을했는지를 알 수 있습니다 찾고 :
당신은 페이지 내 제안의 예를 다음 인쇄를 시도 할 수 있습니다.
많은 시간을 OPOS 및 POS for .Net으로 보내고 난 후에 나는 그만 포기하고 내장 된 System.Drawing.Printing 라이브러리를 사용했습니다. .Net을위한 OPOS와 POS는 일하기가 어려워 결국 궁극적으로 내장 라이브러리와 마찬가지로 작동하지 못했습니다.
저는 영수증 프린터 인 Epson TM-T20II를 사용하고 있습니다.
다음은 저에게 잘 맞았던 코드입니다.
public static void PrintReceiptForTransaction()
{
PrintDocument recordDoc = new PrintDocument();
recordDoc.DocumentName = "Customer Receipt";
recordDoc.PrintPage += new PrintPageEventHandler(ReceiptPrinter.PrintReceiptPage); // function below
recordDoc.PrintController = new StandardPrintController(); // hides status dialog popup
// Comment if debugging
PrinterSettings ps = new PrinterSettings();
ps.PrinterName = "EPSON TM-T20II Receipt";
recordDoc.PrinterSettings = ps;
recordDoc.Print();
// --------------------------------------
// Uncomment if debugging - shows dialog instead
//PrintPreviewDialog printPrvDlg = new PrintPreviewDialog();
//printPrvDlg.Document = recordDoc;
//printPrvDlg.Width = 1200;
//printPrvDlg.Height = 800;
//printPrvDlg.ShowDialog();
// --------------------------------------
recordDoc.Dispose();
}
private static void PrintReceiptPage(object sender, PrintPageEventArgs e)
{
float x = 10;
float y = 5;
float width = 270.0F; // max width I found through trial and error
float height = 0F;
Font drawFontArial12Bold = new Font("Arial", 12, FontStyle.Bold);
Font drawFontArial10Regular = new Font("Arial", 10, FontStyle.Regular);
SolidBrush drawBrush = new SolidBrush(Color.Black);
// Set format of string.
StringFormat drawFormatCenter = new StringFormat();
drawFormatCenter.Alignment = StringAlignment.Center;
StringFormat drawFormatLeft = new StringFormat();
drawFormatLeft.Alignment = StringAlignment.Near;
StringFormat drawFormatRight = new StringFormat();
drawFormatRight.Alignment = StringAlignment.Far;
// Draw string to screen.
string text = "Company Name";
e.Graphics.DrawString(text, drawFontArial12Bold, drawBrush, new RectangleF(x, y, width, height), drawFormatCenter);
y += e.Graphics.MeasureString(text, drawFontArial12Bold).Height;
text = "Address";
e.Graphics.DrawString(text, drawFontArial10Regular, drawBrush, new RectangleF(x, y, width, height), drawFormatCenter);
y += e.Graphics.MeasureString(text, drawFontArial10Regular).Height;
// ... and so on
}
사용자가 맞춤식 드라이버를 사용하여 주변을 어지럽히는 데 도움이되기를 바랍니다. :)
그냥 알다시피, POS == 판매 시점이 – jadarnel27
이것은 다소 큰 문제이며 POS 프린터를 통해 인쇄 가능한 영수증을 만드는 것은 결코 쉬운 일이 아닙니다. StackOverflow는 특정 프로그래밍에 대한 질문이기 때문에 Google에서 먼저 검색해야합니다. – qJake
@ jadarnel27 : 나는 이것을 알고 있고 WEPOS에 대한 아이디어가 있다고 말할 수있다. – Sandy