Jump to content

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

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
capedech

capedech

    Newbie

  • Members
  • Pip
  • 7 posts
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.

Regards,

#2
Brandon W

Brandon W

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 4,828 posts
I'm confused in reading your code and in your text. Do you want the text to be outputted or actually print it out of the printer?

If you want to print it out from the printer, by looking around a bit on Google I came along something this;
    Public Sub PrintDocument()
        'Create an instance of our printer class
        Dim printer As New PCPrint()
        'Set the font we want to use
        printer.PrinterFont = New Font("Verdana", 10)
        'Set the TextToPrint property
        printer.TextToPrint = Textbox1.Text
        'Issue print command
        printer.Print()
    End Sub

Which you have to include the following;
Imports System.Drawing
Imports System.Drawing.Printing

jQuery Selectors Tutorial - jQuery Striped Table tutorial - jQuery Events - jQuery Validation

Sorry if I don't post as often as I did, I'll try to get here as much as possible! I'm working my bum off to get this scholarship and other stuff!