473,416 Members | 1,547 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Printing to POS thermal label printer problem using Print.printer

Hi,
This is my first post and need help with an unexpected problem.
I am an experienced C language programmer but don't have much experience with VB6.0, please excuse me.
I will try to describe the problem in detail and as short as possible.

We bought a chinese thermal printer 55 mm paper width. I need to print barcode labels for marking and classifying parts and components in a warehouse.
I am using Windows 10 professional and the ancient Visual Basic 6.0 IDE installed on Windows 10.
I have made several programs using all VB6.0 basic functions including serial ports, timers, etc.
No problems at all so far.

As many other printers, this POS58A printer has a traditional RS232 port and a USB printer port as well.
The serial connection needs no special driver installed. When using the USB printer port needs a driver supplied with the printer. When this USB driver is installed in Windows 10, the printer appears as POS58A along with other installed printers eg: HP1102P , Microsoft print to PDF, etc.

My VB6.0 program detects all printers available including de POS58A thermal printer.
When using:

Expand|Select|Wrap|Line Numbers
  1. Printer.Print "Hello World" & vbCrLf
  2. Printer.EndDoc
...the printer works perfectly well.

These kind of label printers have built in barcode and QR code functions. By sending simple ASCII table bytes
to the printer, the printer understands an escape sequence that produces several barcode standards.
If you need to print a CODE93 type barcode VB6.0 should issue the following:

Expand|Select|Wrap|Line Numbers
  1. Dim Barcode as String
  2.  
  3. Barcode = "HELLO1234567"
  4. Printer.Print Chr$(29) & "k" & Chr$(72) & Chr$(12) & Barcode & vbCrLf; ' Print bar code93
  5. Printer.EndDoc
The first Chr$(29) is a GS ASCII code that starts the escape sequence for a barcode.
The following "k" follows as part of this sequence. The Chr$(72) instructs the printer to generate
specifically a CODE93 type barcode,among many other possible formats, by changing this number.
The CHR$(12) specifies the length of the barcode in digits. Finally, the contents of the barcode
itself, simple ASCII uppercase characters. The vbCrLf is not required, it just line feeds after
de barcode is printed.

This should print a CODE93 type barcode right away, but it doesn't.

Instead, it prints part of the HELLO1234567, but starting with some garbled characters, as if the
control codes (or non printable characters), those between hex 00 and hex 1F in the ASCII table
are being in some way filtered by the printing process. This extends to almost any special command
for the printer to print different fonts, underline, double width, etc.

Some comments here:

1.
As I run out of ideas, I decided to write exactly the same program but for the serial port using
MS comm control 6.0 (SP6) serial object. I changed the cable, and I have the complete program
up and running.

Instead of the previous code, I am using:

Expand|Select|Wrap|Line Numbers
  1. MSComm1.Output = Chr$(29) & "k" & Chr$(72) & Chr$(12) & Barcode & vbCrLf ' Print bar code93
  2.  
2.
The printer also installs a driver test and configuration software that allows the user to select the
way to talk to the printer, installed printer drivers or serial ports. The self test button on this
program prints a long paper strip full of all possible types of barcodes, QR code, fonts and features.
I can print this test perfectly using the POS58A installed driver and also the serial port, which requires
just to change the cable and switch to the other printer connector. Meaning that Windows is using the
driver to print.

3.
I found in a website a solution that treats the printing job by opening the port as a file and
writing to the file and closing the file when finished. I requires to call the printer by a name such
as LPT1 or the like, but it didn't work. Nothing was printed.

I am sorry for the long explanation but maybe this will help to avoid unnecessary writing.

Could you please help me find a solution for this problem?

Thank you.
Jul 25 '23 #1
0 13927

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Tessa | last post by:
Is there any security reason why you cannot print to a network printer from ASP.NET under IIS6 on Windows 2003 server? I'm using ASP.NET code to print to a server print queue using...
3
by: Michael | last post by:
Hi, I'm trying to print barcodes to the Dymo LabelWriter printer. Put everytime I send a job to the label printer it just outputs an empty label. If I change the default printer back to the...
3
by: John Peterson | last post by:
Hello all! I'm at my wits end trying to search for what I assumed to be a relatively straightforward task. I have a Web application written in C#, and I have a button on the form that I want to...
13
by: Susan Beebe | last post by:
I have downloaded the code described in Microsoft article Q154078. I am trying to send raw ZPL (zebra barcode printer) code from Microsoft access. It works just fine if I hard code the actual...
1
by: Marc Rowe | last post by:
Hello, I have a client who needs to print HTML Files using IE - i have the automation completed, but cannot find anywhere how to print to a printer that is not the default printer - the HTML files...
1
by: hasanainf | last post by:
Hi all and thanking you all in advance for your help My client wants to use a receipt printer. Since I have never used one before I have some questions. 1. Unlike other printers which are set...
0
by: jinsatoemo | last post by:
Hello guys,i'm new here,nice to meet you all :-) I need some help in access,particularly in printing to label printers.I've developed a program that generate labels to print to a label...
0
by: scubar | last post by:
I have a Konica/Minolta 2300 DL printer that is connected via a CAT5 cable to a Qwest 2700HG-D (2-wire) modem/router. My deskside computer is working through the router but does not see the printer....
0
by: Tim | last post by:
Our application has used this PrintersClass module for some time without a problem but some new Toughbooks have caused problems. We use laser printers, usually the default choice, and some label...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.