Solved

Epson Thermal Printing

Posted on 2009-07-06
8
761 Views
Last Modified: 2012-05-07
Morning,

I want to be able to print some text to the far left.

Example
1 x Bread                      £1.00        

But if my middle text is longer then it miss-aligns the £0.00

Example

1 x Bread                      £1.00        
1 x Newspaper                   £1.00

I need to have the £1.00 all align to the left no matter how many chars there are. I am using the Epson ESC commands to the printer directly via the serial port.

What command should I be using? Also does anyone know of any good examples on the www?

I am using vb.net
0
Comment
Question by:richard_gar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 6

Expert Comment

by:BALMUKUND KESHAV
ID: 24783633
@  richard_gar :

How are you formating your output in your application. Are you using VBA ? Pl.put your print command /function which you are using in your APP.
Infact you will have to use rset function to right set the variable's value , before sending it to printer.

Bm Keshav
0
 

Author Comment

by:richard_gar
ID: 24783657
below is my code.

I need to be able to put the following to the far left of the receipt

txtNetSales1.Text
txtNetQty1.Text
txtCash1.Text
TextBox2.Text
txtGrossSales1.Text
txtGrossQty1.Text
        Try
 
            Dim strCom As String
            Dim strBaudRate As String
 
            strCom = "COM" & Form1.txtPort.Text()
            strBaudRate = Form1.txtBaud.Text
 
            With serialPort
                .PortName = strCom
                .BaudRate = strBaudRate
                .Parity = IO.Ports.Parity.None
                .DataBits = 8
                .StopBits = IO.Ports.StopBits.One
            End With
 
            serialPort.Open()
 
            'Init the printer
            serialPort.Write(Chr(27) & Chr(31) & Chr(1))
            serialPort.Write(Chr(27) & Chr(82) & Chr(0))
            serialPort.Write(Chr(29) & Chr(33) & Chr(0))
 
            'Print the report
            serialPort.Write("                              MC #" & txtTill1.Text)
            serialPort.Write(Chr(10))
            serialPort.Write(" X/Z  " & txtTillUser1.Text & "   " & txtDate1.Text & " " & txtTime1.Text & "    " & TextBox1.Text)
            serialPort.Write(Chr(10))
            serialPort.Write("")
            serialPort.Write(Chr(10))
            serialPort.Write(" Inline                              11111")
            serialPort.Write(Chr(10))
            serialPort.Write(" Consolidation                        1000")
            serialPort.Write(Chr(10))
            serialPort.Write(" MC #02            " & txtTime1.Text & "              1375")
            serialPort.Write(Chr(10))
            serialPort.Write(" MC #01            " & txtTime1.Text & "              1372")
            serialPort.Write(Chr(10))
            serialPort.Write(" -----------------------------------------")
            serialPort.Write(Chr(10))
            serialPort.Write(Chr(27) & Chr(82) & Chr(3))
            serialPort.Write("")
            serialPort.Write(Chr(10))
            serialPort.Write(" CZ    0001311  FIXED TTL             " & TextBox2.Text)
            serialPort.Write(Chr(10))
            serialPort.Write("")
            serialPort.Write(Chr(10))
            serialPort.Write(" GROSS                 " & txtGrossQty1.Text & "      " & txtGrossSales1.Text)
            serialPort.Write(Chr(10))
            serialPort.Write(" NET             No    " & txtNetQty1.Text & "      " & txtNetSales1.Text)
            serialPort.Write(Chr(10))
            serialPort.Write(" CASH                            " & txtCash1.Text)
            serialPort.Write(Chr(10))
            serialPort.Write("")
            serialPort.Write(Chr(10))
            serialPort.Write(" -----------------------------------------")
            serialPort.Write(Chr(10))
            serialPort.Write("")
            serialPort.Write(Chr(10))
            serialPort.Write(" CZ    0001315  DEPT                  " & TextBox3.Text)
            serialPort.Write(Chr(10))
            serialPort.Write("")
            serialPort.Write(Chr(10))
            serialPort.Write(" WET SALES             " & txtWetQty1.Text & "      " & txtWetSales1.Text)
            serialPort.Write(Chr(10))
            serialPort.Write(" FOOD                  " & txtDryQty1.Text & "      " & txtDrySales1.Text)
            serialPort.Write(Chr(10))
            serialPort.Write(" -----------------------------------------")
            serialPort.Write(Chr(10))
            serialPort.Write(" TL                    " & TextBox4.Text & "      " & txtTotalDeptQty1.Text)
            serialPort.Write(Chr(10))
            serialPort.Write("")
            serialPort.Write(Chr(10))
            serialPort.Write(" -----------------------------------------")
            serialPort.Write(Chr(10))
            serialPort.Write("")
            serialPort.Write(Chr(10))
            serialPort.Write("                  Normal End")
            serialPort.Write(Chr(10))
            serialPort.Write("")
            serialPort.Write(Chr(10))
            serialPort.Write("")
            serialPort.Write(Chr(10))
            serialPort.Write("")
            serialPort.Write(Chr(10))
            serialPort.Write("")
            serialPort.Write(Chr(10))

Open in new window

0
 
LVL 6

Expert Comment

by:BALMUKUND KESHAV
ID: 24783728
You format your line like this :

   Grossq = Space(10)
   Grsosss=Space(10)
   RSet Grossq = Format(txtGrossQty1.text, "########0.0")
   RSet Grosss = Format(txtGrosssales1.text, "########0.0")
   serialPort.Write(" GROSS                 " +Grossp+"   "+Grosss)

The above line will adjust your grossqty, and gross sales value from right alignment with proper spacing
of 10, now you can calcualate the lenght of your item description and can put max.space-calculated space between the item description and gross qty/gross sale

Bm Keshav
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:richard_gar
ID: 24783762
how is that going to work?

As if I have 10 spaces between them

it would like so:

1 x  bread          £1.00
1 x newspaper          £1.00

you see I have 10 spaces from bread and newspaper I need a way to make the £1.00 be at the far left of the receipt no matter how many chars there are before it.

The description of the product will never be more than 255 chars.

Is there a way to tell the £1.00 to print to the far left no matter how many chars there are in the description like so:

1 x bread             £1.00
1 x newspaper    £1.00
0
 
LVL 6

Accepted Solution

by:
BALMUKUND KESHAV earned 500 total points
ID: 24783791
Do it like this :
   Grossq = Space(10) ' It will assign space 10 for Gross qty value/width
   Grsosss=Space(10)  'It will assign space 10 for Gross sales value/width

   RSet Grossq = Format(txtGrossQty1.text, "########0.0")
   RSet Grosss = Format(txtGrosssales1.text, "########0.0")

   serialPort.Write(trim(itemdescription)+space(100-trim(itemdescription))+Grossq

Assume your max item description length in your table is 100, increase/decrease this number  if req. to increase/decrease space between item description and gross qty.

Bm Keshav



0
 
LVL 6

Expert Comment

by:BALMUKUND KESHAV
ID: 24783918
@ richard_gar :
 Any progress !!!!!!
Bm Keshav
0
 

Author Comment

by:richard_gar
ID: 24784513
soz I will give it a go
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to set focus on a dynamic control 18 50
ASP.NET Load html part first, then start function 2 38
VB6 Enviroment 3 35
Javascript function 3 16
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question