2
我正在開發一個超市系統,它將在使用.net開票後打印pos賬單。.net pos打印機滾印
對於票據打印,我在.net中使用System.Drawing.Printing。
問題是當項目列表太長,當它增加一頁限制pos打印機只打印第一頁和切紙。
以下是我使用的打印代碼示例。請幫我解決這個問題。
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
您指的是什麼POS打印機? ESC代碼控制打印機可能不容易嗎? – t0mm13b
我正在使用EPSON TM-T81 POS打印機。打印完成後會自動裁切紙張。這裏的問題是打印機在打印完一頁後切紙。其餘的頁面不打印。 – las
首先,我會仔細檢查你的頁面長度設置是什麼,因爲它是一個卷,你應該能夠使它很長。我找不到TM-181手冊,但其他Epson打印機的最大打印速度爲1289英寸,並確保您使用一個PrintDocument –