1. Tom McArdle
  2. PowerBuilder
  3. Friday, 5 October 2018 13:07 PM UTC

Hello

Does anyone have a function that will convert a string to barcode 128? I download the

free font CODE128, but now I need to calculate the value to feed it.

I want to avoid the need to purchase from ID Automation.

 

Thank You

Tom

 

 

Alain NYSSEN Accepted Answer Pending Moderation
  1. Tuesday, 1 December 2020 11:57 AM UTC
  2. PowerBuilder
  3. # 1

Hello Brad,

I work with "IDAutomationNativeFontEncoder64.dll" in ...\system32

So I declare :

FUNCTION Long IDAutomation_Universal_C128(String Data2Encode, Ref Long ApplyTilde, Ref String Result, Ref Long iSize) &
Library "IDAutomationNativeFontEncoder64.dll" alias for "IDAutomation_Universal_C128"

 

And the function 'gf_...' :

string result

result = space(250)

long rtn, iSize, iTilde = 1

rtn = IDAutomation_Universal_C128(d2e, iTilde, result, isize)
// rtn is not a reliable result code in the 2012-10-22 version of this dll, so we ignore it

result = left(result, iSize)

return result

 

I did what you said but I receive the error :

"Bad runtime function reference in function gf_..."

 

Could you help me please ?

KR

Alain

Comment
  1. René Ullrich
  2. Tuesday, 1 December 2020 13:17 PM UTC
I think IDAutomationNativeFontEncoder64.dll is only for 64 bit application. If your Powerbuilder application is 32 bit I think it will not work. If you start your application from IDE it is also 32 bit.
  1. Helpful
  1. Alain NYSSEN
  2. Tuesday, 1 December 2020 14:37 PM UTC
Thanks René,

You are right ... I can't use 64bit dll with IDE (32bit)

So I used IdAutomationFontEncoder.dll (32bit) and I was compiling my project in 32 bit

But I placed IdAutomationFontEncoder.dll (32bit) in ... \System32

Or it must be placed in ...\Syswow64 and registered with ...\Syswow64\Regsvr32

Then it works as well in IDE than with .exe

"Oufti :-)"

Thanks

  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Friday, 5 October 2018 16:43 PM UTC
  2. PowerBuilder
  3. # 2

it appears that the font you downloaded originally came from the grandzebu site.

The site also provides VB code to show you how to calculate the check digits - and provides a pretty good reference on how it works.

https://grandzebu.net/informatique/codbar-en/code128.htm

this is relatively simple, and could be generated in PB if you didn't want to bother with a dll.

 

 

Comment
  1. Tom McArdle
  2. Friday, 5 October 2018 17:01 PM UTC
Thank you so much Mike.

I will check that out.



Have a great weekend

Tom
  1. Helpful
There are no comments made yet.
Brad Mettee Accepted Answer Pending Moderation
  1. Friday, 5 October 2018 15:02 PM UTC
  2. PowerBuilder
  3. # 3

You'll need to find source code based on which font you've downloaded. Barcode fonts aren't interchangeable.

Where did you download the font from, and are there any source code examples for generating the strings the font needs?

 

We've been using the ID Automation Universal Font Encoder for 10+ years, it has a large number of supported barcode types, and the DLL is easy to use. The cost & time spent trying to roll your own functions for varying barcodes would probably be higher than the cost of buying a pre-built solution. Our purchase of the font encoder has more than paid for itself. It's a one time cost, for one developer, and there's no cost to distribute the font files. What's not to like about that?

Comment
  1. Tom McArdle
  2. Friday, 5 October 2018 15:10 PM UTC
I Think you are right Brad. Trying to save a few bucks is probably not worth it.

Was ID automation easy enough to install?





I got the font from http://www.barcodelink.net/barcode-font.php . They do have code examples, but no PowerBuilder.





Thank you so much.

Tom



  1. Helpful
  1. Brad Mettee
  2. Friday, 5 October 2018 15:39 PM UTC
The fonts, and one additional file (IDAutomationNativeFontEncoder.dll) are all that's necessary to install (and they have 64bit version of the dll also).

Declare the function:

FUNCTION Long IDAutomation_Universal_C128(String Data2Encode, Ref Long ApplyTilde, Ref String Result, Ref Long iSize) &

Library "IDAutomationNativeFontEncoder.dll" alias for "IDAutomation_Universal_C128;ANSI"



Call it from a function:

// arg is d2e (data to encode)

string result

result = space(250)

long rtn, iSize, iTilde = 1

rtn = IDAutomation_Universal_C128(d2e, iTilde, result, isize) // rtn is not a reliable result code in the 2012-10-22 version of this dll, so we ignore it

result = left(result, iSize)

return result



Result can be plugged into any datawindow object that can have one of the barcode fonts assigned to it (field, static text, compute).
  1. Helpful
  1. Tom McArdle
  2. Friday, 5 October 2018 19:15 PM UTC
Brilliant!!! Thank you so much

Tom
  1. Helpful
There are no comments made yet.
David Peace (Powersoft) Accepted Answer Pending Moderation
  1. Friday, 5 October 2018 14:41 PM UTC
  2. PowerBuilder
  3. # 4

Hi Tom

I think you will have to research this yourself. I'm sure hat the documentation for the font you have installed combined with this:

https://en.wikipedia.org/wiki/Code_128

Would give you a solution...

Cheers

David

Comment
  1. Tom McArdle
  2. Friday, 5 October 2018 15:11 PM UTC
Thanks for the feedback David.

I will check that out although probably ID Automation might be the best solution.



Tom
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.