[英].net pos printer roll printing
I am developing a system for supermarket which will prints pos bill after invoicing using .net. 我正在开发一个用于超市的系统,该系统将在使用.net开票后打印pos账单。
For the bill printing I am using System.Drawing.Printing in .net. 对于票据打印,我在.net中使用System.Drawing.Printing。
The issue was when the item list is too long , when it increase the one page limit pos printer only prints the first page and cut paper. 问题是当项目列表过长时,当它增加一页限制时,pos打印机仅打印第一页并裁切纸张。
Following is the code sample for printing which I used. 以下是我使用的用于打印的代码示例。 Please help me to solve this.
请帮我解决这个问题。
Private Sub printInvoice()
Dim printDocument As New PrintDocument
Dim printController As New StandardPrintController
printDocument.PrintController = printController
AddHandler printDocument.PrintPage, AddressOf PrintDocumnet_Event
printDocument.Print()
End Sub
Public Sub PrintDocumnet_Event(ByVal sender As Object, ByVal e As PrintPageEventArgs)
Try
Dim dataFont As Font = New Font("Courier New", 9, FontStyle.Bold)
Dim leftMargin As Integer = 15
Dim topMargin As Integer = 65
For Each invoiceRow As DataRow In dtInvoice.Rows
Dim code As String = invoiceRow("Item_Code").ToString.Trim
Dim name As String = invoiceRow("Print_Name").ToString.Trim
Dim price As String = String.Format("{0:0.00}", Double.Parse(invoiceRow("Price"))) + "x"
Dim qty As String = String.Format("{0:0.###}", Double.Parse(invoiceRow("Qty")))
Dim amont As String = String.Format("{0:0.00}", Double.Parse(invoiceRow("Amount")))
Dim discount As String = String.Format("{0:0.00}", Double.Parse(invoiceRow("Discount")))
e.Graphics.DrawString(String.Format("{0,-8}", name), dataFont, Brushes.Black, leftMargin, topMargin)
topMargin += 15
e.Graphics.DrawString(String.Format("{0,-10} {1,7} {2,5} {3,8}", code, price, qty, amont), dataFont, Brushes.Black, leftMargin, topMargin)
topMargin += 20
Next
End Sub
Thanx for all. 感谢所有人。 I found the solution.
我找到了解决方案。 I had to check the page height according to item list and add the following when the page exceeds.
我必须根据项目列表检查页面高度,并在页面超出时添加以下内容。
e.HasMorePages = True
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.