Anyway, I have gotten my printing to work fine except for one issue. I want to send printer control codes. For example a [ESC][V] will cause the sheet cutter to slice. I've been trying simple chr() style prints with no sucess. Does anyone have any suggestions. Below is the code I am using to print. The first one is a class followed by the actual print code.
Public Class myPrinter Friend TextToBePrinted As String Public Sub prt(ByVal text As String) TextToBePrinted = text Dim prn As New Printing.PrintDocument Using (prn) prn.PrinterSettings.PrinterName _ = "Generic" AddHandler prn.PrintPage, _ AddressOf Me.PrintPageHandler prn.Print() RemoveHandler prn.PrintPage, _ AddressOf Me.PrintPageHandler End Using End Sub Private Sub PrintPageHandler(ByVal sender As Object, _ ByVal args As Printing.PrintPageEventArgs) Dim myFont As New Font("Microsoft San Serif", 10) args.Graphics.DrawString(TextToBePrinted, _ New Font(myFont, FontStyle.Regular), _ Brushes.Black, 50, 50) End Sub End Class
and on button click
Private Sub ButtCatFive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtCatFive.Click Dim Print As New myPrinter Print.prt("Rehab Tavern" & vbNewLine & "Webster Avenue" [i]control codes[/i]) End Sub
Any suggestions? I also know I can use the built in print object in VB.net but that seems way too complicated to print a few lines of basic text. Plus, I want instant prints of reciepts with out user being prompted. But I digress, I get it to print all right, just not the control codes. I don't know how to combine a [ESC] with a [V].