2
votes

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 
1
If Í,BZx}Î is printed as ascii glyphs then the printer did not use your Code128 font. After Printer is set to the correct device use printer.fontName = "Code 128" : msgbox printer.fontName to make sure it's set to "Code 128". If you see something else check the font list to see if you are using the correct name: for i = 0 to printer.fontCount: debug.? printer.Font(i): next - Alex K.
Thanks for your input, but I have check and the fontName is correct. But still we get a partial barcode printed out (I suspect the element such as Í or Î were printed as some squares, whereas characters like B or Z were converted into barcode-like lines), could it be something to do with language setting on windows? (but it seems to print out Í,BZx}Î correctly if we switch to font Arial) - user3034931
Does it print correctly if you print the string to a form/pic box? 1Í,BZx}Î in my code128 font = tinypic.com/view.php?pic=2d0o1f4&s=8#.UxmtLInesfQ - Alex K.
Yes, unlike direct print with printer object, it manage to print out as barcode like image on picture box or text box, but only correctly printed if I use form 2.0's text box ( iguess it is down to the non-ascii characters; I am using a Chinese Window). Here is an image from direct print via printer object i59.tinypic.com/2uol4cp.jpg - user3034931

1 Answers

0
votes

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

barcode fonts and encoders