Printing Code 128 C barcode using C++ code interacting with OPOS Common Controls 1.8
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Printing Code 128 C barcode using C++ code interacting with OPOS Common Controls 1.8

  1. #1
    Join Date
    May 2012
    Posts
    2

    Printing Code 128 C barcode using C++ code interacting with OPOS Common Controls 1.8

    Hi,

    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:

    Code:
      
    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:

    Code:
      
    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.
    <Real name not allowed>

  2. #2
    Join Date
    May 2012
    Location
    weston super mare
    Posts
    2

    Re: Printing Code 128 C barcode using C++ code interacting with OPOS Common Controls

    Hi

    Your problem may be realted to the type of date you are trying to encode.

    Code128C can only strictly be used with an even number of numeric digits, because it encodes pair of digits as a single bar code element i.e. it is a double-density barcode.

    If there is an uneven number of digits or if the data includes non-numeric digits, then Code128Auto is used to create a composite subsets i.e.

    12345678 will be pure Code128b

    123456789 will be encoded as follows Subset B "1" then Subset C "23456789"

    Of if data contains non numeric digits - 12345A will be encoded as follow Subset B "1" Subset C "2345" Subset B "A"

    Not sure if this helps.

    Regards

    Rob
    www(dot)tantolabels(dot)com
    Barcode Label Printing






    Quote Originally Posted by coolprosu View Post
    Hi,



    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:

    Code:
      
    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:

    Code:
      
    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.
    <Real name not allowed>
    Last edited by Cimperiali; May 8th, 2012 at 07:21 PM.

  3. #3
    Join Date
    May 2012
    Posts
    2

    Re: Printing Code 128 C barcode using C++ code interacting with OPOS Common Controls

    Hi Rob,

    Thanks for your reply. The barcode I'm trying to print has numeric only data and I have ensured it consists of even no. of digits. Infact the no. of digits in the barcode I'm trying to print always remains the same.

    However I realized the real problem behind the error I was getting. From OposPtr.h code I Googled, I found the PTR_BCS_Code128_Parsed constant was introduced in CCO 1.8. The environment I'm in has 1.7 installed in it. The environment can't be changed easily as it involves deployment and hardware driver compatibility issues.

    So the question remains, is there a way to FORCE printing of type C 128 barcode with my numeric only data containing even no. of digits?

    Regards,
    cool

  4. #4
    Join Date
    May 2012
    Location
    weston super mare
    Posts
    2

    Re: Printing Code 128 C barcode using C++ code interacting with OPOS Common Controls

    Hi Cool

    I'm not a programmer, more an expert in barcodes and barcode printing.

    If it's the Epson code you need to generate the Code128c barcode, try this.

    Download Seagull Scientific Bartender[from www(dot)seagullscientific(dot)com/aspx/free-bar-code-label-printing-software-download(dot)aspx] and install it under 30-day free of charge trial.

    Then download the windows driver for your Epson printer.

    Create your code128c barcode in bartender (you can force subset C in bartender)

    Then print to the epson printer, it produces the correct barcode then print again but this time use "print-to-file" rather than the printer itself, and you should get a text file containing all of the text strings used to create the barcode

    Not sure if this will help of not.

    Regards

    Rob

    Plain, Printed and Barcode Labels[www(dot)tantolabels(dot)com]



    Quote Originally Posted by coolprosu View Post
    Hi Rob,

    Thanks for your reply. The barcode I'm trying to print has numeric only data and I have ensured it consists of even no. of digits. Infact the no. of digits in the barcode I'm trying to print always remains the same.

    However I realized the real problem behind the error I was getting. From OposPtr.h code I Googled, I found the PTR_BCS_Code128_Parsed constant was introduced in CCO 1.8. The environment I'm in has 1.7 installed in it. The environment can't be changed easily as it involves deployment and hardware driver compatibility issues.

    So the question remains, is there a way to FORCE printing of type C 128 barcode with my numeric only data containing even no. of digits?

    Regards,
    cool
    Last edited by Cimperiali; May 8th, 2012 at 07:35 PM.

  5. #5
    Join Date
    Jan 2013
    Posts
    1

    Re: Printing Code 128 C barcode using C++ code interacting with OPOS Common Controls

    I have never generated barcodes in C++. But I am now generaing Code 128 barcode in C# with a barcode generator. You may try to find professional passages on this site.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center