Question Why the receipt didn't print like what I want ??


Well-known member
Oct 29, 2008
Programming Experience
Hi all,
I got a problem.
I'm making a small POS program.
I'm using EPSON TM-U220 Printer for receipt printer.
There's a few fonts that the driver gives :
FontA11, FontA12, FontA11[254], FontB11, control, controlA, etc..
I use FontA11.

When I tried to print it with Ms. Word, it printed perfectly.
The columns was right (40 columns) and each word has the same width.

But when I tried to print it with Vb.Net, the font changed.
I don't know if it changed or not, but the output from Ms. Word and Vb.Net has different style of fonts.
Each line has different columns.
And Each word has different width.
I've tried other fonts, but the results're still the same.

I'm using e.Graphics.DrawString method.

Here's my code :
Private Sub PrtDcmTrans_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrtDcmTrans.PrintPage
        Dim Smb_Y As Integer = 0
        Dim Batas_Kiri As Integer = 0
        Dim Batas_Atas As Integer = 0

        Dim Jns_Huruf As Font = New Font("control", 8)
        Dim HeightJns_Huruf As Integer = Jns_Huruf.GetHeight(e.Graphics)

        Dim ArrStruk() As String
        ArrStruk = Struk.Split(vbCrLf)

        For I As Integer = 0 To ArrStruk.GetUpperBound(0)
            If I > 0 Then ArrStruk(I) = ArrStruk(I).Substring(1)

            Smb_Y = Batas_Atas + I * HeightJns_Huruf
            e.Graphics.DrawString(ArrStruk(I), Jns_Huruf, Brushes.Black, Batas_Kiri, Smb_Y, New StringFormat)
        Next I
    End Sub

What should I do?
Is there any other methods for printing?

Please help me.

Thank You in Advance.

Top Bottom