Creating your own bar code functions

The bar code functions in our products are usually sufficient for the vast majority of bar code projects. However, it is easy to create additional bar code functions for special applications.

Note: Bar code functions you create, will rely on our; functions, components and fonts. If you distribute your new function, you must purchase a license for each person who will print bar codes. 

Use the existing bar code functions, in the supplied Visual Basic module, as examples. For example, if you examine function CIA_ITF, you can see this bar code function contains just one line of code.

Visual Basic
Function CIA_ITF (Msg As String)
  CIA_ITF = BCP("ITF-0.BA", Msg)
End Function
C/C++
char *CIA_ITF (char *Msg) {
  return BCP("ITF-0.BA", Msg);
}

To get the bar code result, function CIA_ITF( ) calls function BCP( ).

Function BCP( ) can be used to return any bar code type you require, by using a string argument to define the bar code type you require. For example, the following string is used to return an ITF (Interleaved 2 of 5) bar code with added check character;

"ITF-0.BA"

See: Specifying a bar code type to discover other strings you can use to return different bar codes.

See: Printing check characters to discover how check character options can be specified.

See: Printing human-readable characters to discover how to create human-readable text.

See: Bar code options / formats to discover how you can select special features of each bar code type.


Example of a new function

If you want to print human-readable text below ITF (Interleaved 2 of 5) bar codes, and you want the text to include the added check character, you can write this function;

Visual Basic
Function MY_ITF_HUMAN (Msg As String)
  MY_ITF_HUMAN = BCP("ITF-0.HA", Msg)
End Function
C/C++
char *MY_ITF_HUMAN (char *Msg) {
  return BCP("ITF-0.HA", Msg);
}

BCP( ) returns human-readable text, if character H is used in the string argument which defines the bar code type.

Use your new MY_ITF_HUMAN function to print human-readable text underneath ITF (Interleaved 2 of 5) bar codes. Use two separate expressions to print a complete bar code with human-readable text underneath, like this;

Separate expressions Printed results Font used to print result
=CIA_ITF_A("123456") CIA ITF Medium, 14 point.
=MY_ITF_HUMAN("123456") 01234565 Arial Bold, 10 point.

Human-readable characters are usually printed underneath bar codes, but you could print them on top if you wish, or elsewhere.

Note: You can instantly see, from the human-readable text, that 5 has been added as a bar code check character. Also, because ITF (Interleaved 2 of 5) bar codes must be an even length, a leading 0 has also been automatically added to the front.

When printing human-readable characters you can use any regular text font; Arial, Courier, Times, etc.

 

 

 


Copyright 2000 CIA (BAR CODES) UK. All rights reserved. Reproduction prohibited.