Printing Code128 barcode using printer object in vb6 (using font)

user3034931 picture user3034931 · Mar 6, 2014 · Viewed 7.1k times · Source

We have some ancient vb6 program that creates barcode using printer objects that relies on window fonts, which works fine with code39. Recently we need to switch the font to code128, after some work we converted the input into code128 format string, and trying print using the same method, however, the printout does not seem right (strange thing is, when we copy the converted string into excel and use the same code 128 font to print it out, it display and print out prefectly)

I was wondering if anyone had the same experience, if so, can anyone shred some lights please?

The following are the code we used to print out barcode

dim sOrg as string
sOrg = "12345888"

printer.fontName = "code39"
printer.print sOrg    'This prints it out perfectly

'However when we change font to code
'this returns   Í,BZx}Î   which can be copy onto Excel and print out properly
sOrg = convertTo128(sOrg)   
printer.fontName = "Code 128"
printer.print sOrg     'print out with part barcode line, part squares 

Answer

Ashwani Kumar picture Ashwani Kumar · Apr 11, 2014

You may use following project which includes VB6 project and open Barcode Font

barcode fonts and encoders