hola he encontrado una clase de ejemplo bastante buena que sirve para imprimir tickets, mmmmmm bastante util obiamente para el que quiere imprimir tickets, jajajajaja queria ver si me hechaban una manito con la traduccion para poder implementarla en visual el link original donde se encunetra la informacion es:
http://www.foromsn.com/index2.php?Ver=Mensaje&Id=178209
la clase en c# esta en :
http://mig16.cep.la/Ticket.cs
Y LA HE TRADUCIDO CASI TODA PERO AUN TENGO PROBLEMAS CON ALGUNAS COSAS ACA ESTA LO QUE HE TRADUCIDO:
Imports System
Imports System.Drawing
Imports System.Drawing.Printing
Imports System.Collections
Namespace BarControls
Public Class Ticket
Private headerLines As ArrayList = New ArrayList
Private subHeaderLines As ArrayList = New ArrayList
Private items As ArrayList = New ArrayList
Private totales As ArrayList = New ArrayList
Private footerLines As ArrayList = New ArrayList
Private headerImage As Image = Nothing
Private count As Integer = 0
Private maxChar As Integer = 35
Private maxCharDescription As Integer = 20
Private imageHeight As Integer = 0
Private leftMargin As Single = 0
Private topMargin As Single = 3
Private fontName As String = "Lucida Console"
Private fontSize As Integer = 9
Private printFont As Font = Nothing
Private myBrush As SolidBrush = New SolidBrush(Color.Black)
Private gfx As Graphics = Nothing
Private line As String = Nothing
Public Sub New()
MyBase.New()
End Sub
Public Property HeaderImage() As Image
Get
Return HeaderImage
End Get
Set(ByVal value As Image)
If (headerImage <> value) Then
headerImage = value
End If
End Set
End Property
Public Property MaxChar() As Integer
Get
Return MaxChar
End Get
Set(ByVal value As Integer)
If (value <> maxChar) Then
maxChar = value
End If
End Set
End Property
Public Property MaxCharDescription() As Integer
Get
Return MaxCharDescription
End Get
Set(ByVal value As Integer)
If (value <> maxCharDescription) Then
maxCharDescription = value
End If
End Set
End Property
Public Property FontSize() As Integer
Get
Return FontSize
End Get
Set(ByVal value As Integer)
If (value <> fontSize) Then
fontSize = value
End If
End Set
End Property
Public Property FontName() As String
Get
Return FontName
End Get
Set(ByVal value As String)
If (value <> fontName) Then
fontName = value
End If
End Set
End Property
Public Sub AddHeaderLine(ByVal line As String)
headerLines.Add(line)
End Sub
Public Sub AddSubHeaderLine(ByVal line As String)
subHeaderLines.Add(line)
End Sub
Public Sub AddItem(ByVal cantidad As String, ByVal item As String, ByVal price As String)
Dim newItem As OrderItem = New OrderItem(Microsoft.VisualBasic.ChrW(63))
items.Add(newItem.GenerateItem(cantidad, item, price))
End Sub
Public Sub AddTotal(ByVal name As String, ByVal price As String)
Dim newTotal As OrderTotal = New OrderTotal(Microsoft.VisualBasic.ChrW(63))
totales.Add(newTotal.GenerateTotal(name, price))
End Sub
Public Sub AddFooterLine(ByVal line As String)
footerLines.Add(line)
End Sub
Private Function AlignRightText(ByVal lenght As Integer) As String
Dim espacios As String = ""
Dim spaces As Integer = (maxChar - lenght)
Dim x As Integer = 0
Do While (x < spaces)
espacios = (espacios + " ")
x = (x + 1)
Loop
Return espacios
End Function
Private Function DottedLine() As String
Dim dotted As String = ""
Dim x As Integer = 0
Do While (x < maxChar)
dotted = (dotted + "=")
x = (x + 1)
Loop
Return dotted
End Function
Public Function PrinterExists(ByVal impresora As String) As Boolean
For Each strPrinter As String In PrinterSettings.InstalledPrinters
If (impresora = strPrinter) Then
Return True
End If
Next
Return False
End Function
Public Sub PrintTicket(ByVal impresora As String)
printFont = New Font(fontName, fontSize, FontStyle.Regular)
Dim pr As PrintDocument = New PrintDocument
pr.PrinterSettings.PrinterName = impresora
AddHandler pr.PrintPage, AddressOf Me.pr_PrintPage
pr.Print()
End Sub