0

I'm trying to print Code 128 C type barcode (as type A/B would be too wide for my requirements) through Epson TM-H6000III receipt printer using OPOS Common Controls 1.8. My code is written in C++.

Normally, I print the barcode using the following code snippet:

const LONG PTR_BCS_Code128 = 110;
lOposBarcodeType = PTR_BCS_Code128;
lReturn = m_PosPrinter.PrintBarCode(2,*lpszTextline,lOposBarcodeType,120,5,PTR_BC_CENTER,PTR_BC_TEXT_BELOW);

Here, *lpszTextline represents the data to be printed as barcode.

From suggestions found online, I tried to make the following changes to print the barcode in Code 128 C format:

const LONG PTR_BCS_Code128_Parsed = 123;
lOposBarcodeType = PTR_BCS_Code128_Parsed;
lReturn = m_PosPrinter.PrintBarCode(2,*lpszTextline,lOposBarcodeType,120,5,PTR_BC_CENTER,PTR_BC_TEXT_BELOW);

and tried to format the barcode data in various ways:

  • Leading "{C"
  • Leading "{C", trailing "H"
  • Making no. of characters in the data even

But none of the ways worked. It always resulted in OPOS_E_ILLEGAL error with ResultCodeExtended = 300003. I cannot find more information about the extended code in the Internet either.

Any help in this regard will be highly appreciated.

Thanks in advance. Prosu

Prosu
  • 11
  • 1
  • 5
  • 128C encodes numbers only 00-99. If you're trying to add ASCII text you need to use 128A or 128B -- or convert the ASCII to numbers ( '{C' = 91 35 ) and remember to convert it back on scan. – charlesbridge May 04 '12 at 18:41

1 Answers1

0

The mode is often determined by the printer firmware, based on the data you are trying to print. The best behavior is when it tries to print as compact as possible: mode C is used if the data is all numeric, mode A is used if it's alphabetic, etc., and it switches from mode to mode as needed: a 17 digit number might print as mode C for the first 16 digits, then switch to mode A for the 17th digit.

If your printer firmware handles this directly, you may not even be able to choose the mode yourself. Alternately, some thermal printers cannot print anything but mode C and will return an error if you try to print alphabetic characters. (We had some old IBM Suremark printers that could only print mode C.)

You should check with Epson.

John Deters
  • 4,295
  • 25
  • 41