Universal Barcode Font Kit

dLSoft Universal Barcode Font Kit By dLSoft This manual was produced using ComponentOne Doc-To-Help.™ Contents Universal Barcode Fonts 1 Intro...
Author: Dora Whitehead
1 downloads 0 Views 1003KB Size
dLSoft

Universal Barcode Font Kit

By dLSoft

This manual was produced using ComponentOne Doc-To-Help.™

Contents Universal Barcode Fonts

1

Introduction ............................................................................................................................... 1 Installation ................................................................................................................................. 1 Installing additional fonts ............................................................................................ 2 Using with CreateObject ............................................................................................................ 3 The 1D Fonts & Tools ............................................................................................................... 4 1D Barcode types supported ........................................................................................ 5 1D Barcode Types Table ............................................................................................. 5 The DLUNIF DLL ..................................................................................................................... 7 1D Function calls ....................................................................................................................... 8 Direct creation functions ............................................................................................. 8 Functions for setting and using default characteristics .............................................. 10 Information functions ................................................................................................ 12 Error codes ................................................................................................................ 13 The Uniocx control .................................................................................................................. 14 Placing the control on a form .................................................................................... 14 Property pages ........................................................................................................... 15 The Control’s Properties............................................................................................ 15 The Control’s Methods .............................................................................................. 16 Uninet .NET component .......................................................................................................... 18 Uninet barcode types table ........................................................................................ 18 Using uninet.NET Visual Studio.NET ..................................................................... 19 Setting and retrieving property values programmatically .......................................... 20 Licensing the .NET component ................................................................................. 20 Properties ................................................................................................................... 20 Information properties ............................................................................................... 22 Methods ..................................................................................................................... 23 The 2D Barcode Fonts & Tools ............................................................................................... 25 The U2DDFU DLL.................................................................................................................. 25 2D Function calls ..................................................................................................................... 26 The U2Docx Control ............................................................................................................... 31 Placing the control on a form .................................................................................... 31 Property pages ........................................................................................................... 32 Control Properties...................................................................................................... 32 Control methods ........................................................................................................ 33 U2Dnet .NET component ........................................................................................................ 35 Using the .NET Component in Visual Studio ........................................................... 35 .NET Component Properties...................................................................................... 37 .NET Information properties ..................................................................................... 39 .NET Component Methods ........................................................................................ 40 Error Codes .............................................................................................................................. 41 Appendix ................................................................................................................................. 42 Allowed parameter values ......................................................................................... 42 Aztec Symbols ........................................................................................................... 42 Datamatrix ................................................................................................................. 43 PDF417...................................................................................................................... 44

dLSoft Universal Barcode Font Kit

Contents  iii

QR Code barcodes ..................................................................................................... 46 Micro QR Code ......................................................................................................... 48

Index

iv  Contents

49

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts

Introduction Barcode fonts enable you to print barcodes on high quality graphics printers that can accept fonts (i.e. a Windows supported graphics printer or a PostScript printer that can accept downloaded fonts). However, the user needs to be aware of a number of factors that determine whether printed barcodes can actually be scanned correctly. 1. Just because you are using a barcode font, this does NOT mean that you can type ABC, render it in the barcode font, and produce a scannable barcode image. Barcodes – especially 2D barcodes like PDF417 – include other "characters" in addition to those which you enter as data. In the case of PDF417 each row of the barcode starts with a start pattern and ends with a stop pattern. Many of the characters in the barcode are actually "error correction digits" designed to enable the barcode to be decoded correctly even if some parts of the image have been damaged. 2. The thickness of bars and spaces in barcodes is important. Some types of barcode use only two thicknesses of bar, others use three thicknesses, and others more. Even when you print a barcode using a dLSoft barcode font, you need to ensure that the barcode has not been printed too small - so that within the resolution of the printer a single thickness bar has been printed at the same size as a double thickness bar. Consequently it is essential that you check that a printed barcode is readable using an appropriate scanner or reader. Barcodes printed by laser or quality ink-jet printer will, in general, be printed correctly, but codes printed by matrix printers must be reproduced at a large enough scale that the barcodes unit size is at least as large as the printer's pins. 3. Bar thickness reduction: Most dLSoft barcode fonts (apart from the GS1 Databar font) are supplied in three bar thicknesses. The Wide font (and its variants - names ending in W) should be suitable for most 600 and 1200 dpi laser printers - it has the bar/space ratio defined at its correct value. The Regular font (names ending in R) has all bars reduced by 5-8% and will probably be a better choice for 300 dpi laser printers and good quality ink-jets. The Narrow font (names ending in N) has all bars reduced by 10-16% and is supplied for users who will be creating master copy which will subsequently be printed using a wet ink technique (in which the ink spreads, so making each bar thicker than in the master). The narrow fonts should only be used if you know that a bar thickness reduction is required. Picking the wrong font usually produces unreadable images! If greater control of bar thickness is needed then an image creating system, such as dBarcode, will be required.

Installation The Universal Barcode Font Kit installer can install support for 1D barcodes, 2D barcodes or both. The components and fonts installed will depend on the option you have selected during installation. The distribution provides a self-extracting executable file that will install to user-defined folders on your computer a number of items: The fonts are provided in TrueType, OpenType and PostScript formats. Only the TrueType fonts are registered on your Windows system during the installation process. If you wish to use the other font types you should extract these from the

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  1

zip file placed in the samples folder and install these on your system – by right-click on the font and selecting Install from the pop-up menu. A personal folder (Universal Font Kit Samples) will also be created to contain sub folders for various samples, including C/C++, Microsoft Office, Visual FoxPro, Visual Basic 6, and .NET. The C/C++ projects may be built for 32 or 64 bit systems using either Unicode or ANSI libraries. The samples folder will also contain the Help files and a README file that may provide information not available when this manual was created. The installation will contain both Unicode and legacy ANSI DLLs which, apart from file names, are identical except for the use of strings and string pointers. Strings are of TCHARs which in the Ansi DLL are chars and in the Unicode DLLs are wchars. Visual Studio users should ensure that the correct lib (eg. either dlunifu.lib or dlunif.lib) is selected for the character set used by a project.

1D components 32 bit installation The 1D DLLs DLUNIFU.DLL and DLUNIF.DLL are copied to the Windows System32 folder so that they are accessible to the samples provided. DLUNIFU.DLL is the Unicode version of the library, while DLUNIF.DLL is the legacy ANSI version. The Visual C sample source code may be compiled to use either library by selecting the Release or RelU projects. The DLLs folder will contain the 32 bit 1D Active-X control UNIOCX.OCX which will self-register. 64 bit installation The 64 bit DLLs are not installed on a 32 bit system. The 32 bit 1D DLLs are copied to the Windows SysWOW64 folder, and the 64 bit 2D DLLs DLUNIF64U.DLL and DLUNIF64 are placed in the Windows System32 directory where they are accessible to the demo programs. The DLLs folder will contain the 64 bit 1D Active-X control UNIOCX.OCX which will self-register.

2D components 32 bit installation The 2D DLLs U2DDFU.DLL and U2DDF.DLL are copied to the Windows System32 folder so that they are accessible to the samples provided. U2DDFU.DLL is the Unicode version of the library, while U2DDF.DLL is the legacy ANSI version. The Visual C sample source code may be compiled to use either library by selecting the Release or RelU projects. The DLLs folder will contain the 32 bit 2D Active-X control UNIOCX.OCX which will self-register. 64 bit installation The 64 bit DLLs are not installed on a 32 bit system. The 32 bit 1D DLLs are copied to the Windows SysWOW64 folder, and the 64 bit 2D DLLs U2DDF64U.DLL and U2DDF64 are placed in the Windows System32 directory where they are accessible to the demo programs. The DLLs folder will contain the 64 bit 1D Active-X control UNIOCX.OCX which will self-register.

Installing additional fonts While most of the commonly used fonts are installed automatically, you may wish to install additional fonts, including reduced or narrow fonts, or Postcript variants.

2  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

Note that some additional fonts are supplied in compressed folders. Please copy the contents of a compressed folder to a normal temporary folder before attempting to install the fonts. The compressed fonts folder will be located under your chosen samples folder – which by default will in your Documents folder.

Windows XP/2003/Vista Open the Font Applet in the Windows Control Panel From the Fonts window menu bar choose "Install New Font". The Add fonts dialog appears. Use the Drives and directory list boxes to select the installation directory containing your fonts. (If you are transferring the fonts to another computer obviously copy them from the original installation directory to some medium that can be accessed by the the new machine.) Ensure that the "Copy Fonts to Fonts folder" check box is checked. Select the fonts you wish to install from the list presented, and then push the OK button.

Windows 7 For TrueType/OpenType fonts: Open the Control Panel Choose Appearance and Personalisation. Click on Fonts to open the Fonts windows Now drag the fonts you require to the Fonts Windows For PostScript fonts double-click on the .PFM file. The font viewer opens. Click on the Install button at the top of the viewer.

Windows 8 Open File Explorer (Windows Key + X, select File Explorer from pop-up menu). Click on Fonts to open the Fonts windows Now drag the fonts you require to the Fonts Windows For PostScript fonts double-click on the .PFM file. The font viewer opens. Click on the Install button at the top of the viewer. Your fonts are now ready for use, and the temporary folder may be deleted.

Using with CreateObject While the components can be added to applications at design-time (as described in the sections above) they may also be created at run-time using CreateObject. A simple example of code is shown here for a VB6 application consisting of a form containing a TextBox:

Public abc As Object Private Sub Form_Load() Set abc = CreateObject("U2DOCX.U2DocxCtrl.1") abc.CodeType = 5

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  3

abc.Caption = "Hello World" Text2.Text = abc.Output End Sub When the form loads the abc object is created, some of its properties are specified, then the resulting barcode characters placed in the TextBox. The string in the CreateObject function is the Class name of the component. For the 1D component the class name is “UNIOCX.UniocxCtrl.1” While for the 2D component it is “U2DOCX.U2DocxCtrl.1” Objects created this way may have their properties set in code or by providing a call to one of the components methods, such as Abc.ShowProps

The 1D Fonts & Tools The Universal Barcode Font kit includes fonts of 5 height/width ratios – with the UNAxxx fonts being the tall and thin variety and UNExxx being short and fat! The ratios (for the narrowest bar) are: UNA UNB UNC UND UNE UNF

50:1 33:1 25:1 20:1 15:1 33:1 (Clocked codes only)

Each font is supplied with full or correct width bars (the UNxWxx fonts -wide), and fonts in which the bar width is reduced by 8% (UnxRxx - regular), 16% (UnxNxx - narrow) and 24% (UnxTxx - thin). For most modern printers the wide fonts are suitable, while for older printers and those which have problems with fine lines, the regular fonts are recommended. The narrow and thin fonts are primarily intended for systems in which ink spreads. The kit also include a number of fonts for creating cosmetic GS1 symbols. These fonts may be used for EAN-13, EAN8, UPC-A, UPC-E, ISBN, ISSN and ISMN symbols. Each of the components included in the kit may be instructed to encode data for these fonts by setting the GS1 flag as described in the component reference. The fonts are: DBWE EANUPChalf-height, full width bars DBRE EANUPC half-height, reduced width bars DCWE EANUPCfull-height, full width bars DCRE EANUPC full-height, reduced width bars Each font is supplied in Normal and Bold variants – the Bold variant will create a barcode approximately 20% wider than the Normal variant. An approximately nominal size barcode may be created using DCWE EANUPC at 72 point. Note that using the UNxx fonts while the GS1 flag is set, or using the DxxE fonts without the GS1 flag set will result in a meaningless jumble of bars! While most barcode can be printed at any size beyond a certain minimum, some have standard widths (such as the EAN and UPC retail codes) which should be followed. The clocked codes (such as PostNet, RM4SCC, etc) are more critical, in that both the number of bars per inch and the height of the bars must be within certain limits. The characters for the clocked code are provided ONLY in the UNF fonts, and should be reproduced at the following sizes: Australia Post 16-17 point

4  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

Korean PA 26-28 point PostNet/Planet 18 point RM4SCC 16-17 point Fonts are provided in TrueType (TTF), OpenType (OFT), PostScript Type 1 (PFA) and PostScript Type 3 (PFB) formats; the PostScript varieties include the associated INF, PFM and AFM files. All fonts are placed in the appropriately named sub-folder of the fonts folder in the product installation directory, and any font may be installed as described below.

1D Barcode types supported In the table below the types of barcodes supported by this release of the library are summarised, together with the type and number of characters, which are specified for that barcode type. In this connection "any" means capital letter and number characters; in some cases additional characters are defined, but lower case letters are not permitted. The code# represents the code type number used in calls to the DLL (DLUNIFU.DLL). Telepen provides codes for upper and lower case letters and most printable characters. Only Extended Code 39 and the EAN 128 and Code 128 codes provide symbols for the full ASCII character set. There are many named barcode types, which are actually derivatives of major types. To avoid the table (and userprogramming) becoming excessively complex, both the table and calls to the library report only the generic name. For example: The ISBN, ISSN and JAN coding scheme are all variants of the EAN scheme. There are several coding schemes (such as DEFCON) which are actually Code 39, and some countries use Code 128 under other names for mail tracking (as in the UK).

1D Barcode Types Table code#

Code type

no. of characters

check digit

0

EAN13

13 numbers

1

EAN-8

8 numbers

2

EAN13+2

15 numbers

1

3

EAN13+5

18 numbers

1

4

UPC-A

12 numbers

1

5

UPC-E

7 numbers

1

6

ITF-14

14 numbers

1 (EAN optional)

7

ITF-6

6 numbers

8

Code 39

any

1 optional

9

Code 128

any*

automatic

10

GS1-128

any*

automatic

11

2 of 5

any numbers

12

Interleaved-2 of 5

number pairs

13

3 of 9

any

dLSoft Universal Barcode Font Kit

1

1 optional

Universal Barcode Fonts  5

14

Code B

any numbers

15

Code 11

any

16

Codabar

any

17

MSI

any numbers

1 or 2

18

Ext. Code 39

any (full ASCII)

1 optional

19

UPCA+2

14 numbers

1

20

UPCA+5

17 numbers

1

21

EAN8+2

10 numbers

1

22

EAN8+5

13 numbers

1

23

UPCE+2

9 numbers

1

24

UPCE+5

12 numbers

1

25

Telepen numeric

any

1 optional

26

Telepen ASCII

any

1 optional

27

Telepen begin numeric end

any

1 optional

28

PostNet type A

5 numbers

1

29

PostNet type C

9 numbers

1

30

PostNet type C'

11 numbers

1

31

FIM A

fixed code

0

32

FIM B

fixed code

0

33

FIM C

fixed code

0

34

RM4SCC

any

1

35

4-State

any

1 optional

36

Code 93

any

2 optional

37

Ex Code 93

any (full ASCII)

2 optional

38

ISBN

9/10 digit ISBN

1 automatic

39

Matrix 2/5

numeric

1 optional

40

Plessey

numeric/some alpha

2

41

Australia Post

numeric

automatic

42

Swiss Post

fixed code

0

43

Deutsche Post

numeric

44

SISAC

SICI codes

1

45

EAN-14

13

1

46

Planet Origin

9

1 automatic

47

Planet Destination

9

1 automatic

48

ISSN

9/10 digit ISSN

1 automatic

49

ISMN

8/9 digit ISMN

1 automatic

50

SSCC

17

1

51

Korean Postal Authority

6

1

52

Italian Postal 3/9

2+8+c+2

1

53

Italian Postal 2/5

12

1 automatic

54

ISBN+2 digit

Any / 2

1 automatic

55

ISBN+5 digit

Any / 5

1 automatic

6  Universal Barcode Fonts

1 or 2

dLSoft Universal Barcode Font Kit

56

ISSN+2 digit

Any / 2

1 automatic

57

ISSN+5 digit

Any / 5

1 automatic

58

Japan Post

Any

1 automatic

59

IATA 2 of 5

Any numeric

60

China Postal Code

Any numeric

1 optional

61

Intelligent Mail

numeric

0

62

Code 128 Subtype A

1 automatic

63

Code 128 Subtype A

1 automatic

64

UPC-E0

12 numeric

1

65

UPC-E1

12 numeric

1

66

InfoMail Barcode A

numeric

0

67

PZN

numeric

1 automatic

68

Databar Omnidirectional

13 numeric

0

69

Databar Truncated

13 numeric

0

70

Databar Limited

13 numeric

0

71

Databar Expanded

Any

0

72

HIBC Code 39

various

1

73

HIBC Code 128

various

1

numeric

1

Fixed code

0

TM

74

IM

75

FIMD

Package Barcode

The DLUNIF DLL The 32 bit and 64 bit DLLs differ in name but are functionally equivalent. The 32 bit DLL is DLUNIFU.DLL and the 64 bit version is DLUNIF64U.DLL; the legacy ANSI versions are DLUNID.DLL and DLUNIF64.DLL respectively. In the description that follows only the 32 bit DLL name will be used, but the comments apply equally to the 64 bit version. To convert a string of characters into the bars and spaces required for the barcode requires converting the character string into another string – made up of only the 0 – z (ASCII 48 – 122) characters present in the Universal Barcode Font. The DLUNIF.DLL will perform this conversion, and provides three function calls which can either return the required string, copy it to the clipboard, or save it to a named disk file. These functions may be called from Visual Basic (including Visual Basic for Applications in Microsoft Office), Visual C++, Visual Foxpro, Delphi, C++ Builder, and in fact virtually every language that can make DLL calls. The functions are called with parameters that specify the options available for the barcode: szIn – is a pointer to a string containing the bytes used as data to create the barcode. While passed as a text string, the string can contain non-text bytes (including ASCII 0) provided that the length parameter (n) is used to specify the length of the data. If n is 0, then the string is assumed to be a null-terminated ASCII string. n – a pointer to an integer which is either 0 or specified the length of the data in szIn. Code – a pointer to an integer that specifies the type of barcode to be created. The complete list of codes and the barcode types supported is shown above. flags – a pointer to an integer that specifies additional characteristics of the barcode. The integer uses bit settings to enable specific properties.

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  7

The following flag bits are used in the current release: Bit

Property

1

Automatic check digit

2

Wide bars = 3X units

3

GS1 style

4

Extra 1 setting

5

Extra 2 setting

Automatic Check Digit: When this flag is set calls to the DLL will automatically calculate optional check digits and include it/them in the barcode produced. When this flag is not set it is assumed that the user has supplied data including the check digit. Note that the flag is ignored for barcode types that have hidden check digits (Code 128 and EAN 128); for these code types the check digit is always calculated by the DLL. Wide Bars: When this flag is set wide bars are produced at 3X units width. When the flag in not set wide bars are produced at 2X units width. Note that this flag is ignored for barcode types that do not allow a variable width ratio. GS1 style: When flag is set encodes the data for use with any of the DxxE cosmetic GS1 fonts. May be used for EAN13, EAN-8, UPC-A, UPC-E, ISBN, ISMN or ISSN barcode types only. For other barcode types an error will be reported. Extra 1 and Extra 2: These flags have an effect that is barcode type dependent; see the details under the barcode type discussed in the Barcodes HELP file supplied with this product.

1D Function calls The available function calls are listed below.

Direct creation functions The first four calls allow font-based barcodes to be created from specific parameters passed in to the function.

BarsOutUn() Declared for C as int WINAPI BarsOutUn(HDC hdc,int xin, int yin, LPTSTR szin, int code, int flags, int fontsize,LPTSTR fontname); This function creates the barcode in a device context at coordinates xin,yin (in MM_TEXT units). where szIn is a pointer to a string containing the text which is to be converted into the barcode; code specifies the barcode type flags sets barcode characteristics, fontname specifies the name of the font used to display/print the barcode, and fontsize is the height (in Points) of the font used to display/print the barcode. Returns 0 if the function is successful, or an error code if the function fails.

BarCdf () - creates text for Universal Barcode Font and returns text in szOut Declared for C as

8  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

int WINAPI BarCdf(LPSTR szIn,LPINT n, LPINT code, LPINT flags, LPSTR szOut); where szIn is a pointer to a string containing the text which is to be converted into the barcode; n is the number of characters in the string (or 0 – in which case the string may not contain NULL characters), code specifies the barcode type flags sets barcode characteristics, szOut is a pointer to a string which will receive the characters to be rendered in the barcode font. Return the number of characters in the converted string, or less than zero if conversion has failed – in which case the absolute value of the return is the error code. Basic declaration Private Declare Function BarCdf Lib "dlunif" (ByVal szIn As String, ByRef n As Long, ByRef cd As Long, ByRef fl As Long, ByVal szOut As String) As Long

BarCdc () - creates text for Universal Barcode Font and copies text to the Windows clipboard Declared for C as int WINAPI BarCdc(LPSTR szIn,LPINT n, LPINT code, LPINT flags); where szIn is a pointer to a string containing the text which is to be converted into the barcode; n is the number of characters in the string (or 0 – in which case the string may not contain NULL characters), code specifies the barcode type flags sets barcode characteristics. Returns 0 if successful, or –1 otherwise. Basic declaration Private Declare Function BarCdc Lib "dlunif" (ByVal szIn As String, ByRef n As Long, ByRef cd As Long, ByRef fl As Long) As Long

BarCdw () - creates text for Universal Barcode Font and writes text to file szFilename Declared for C as int WINAPI BarCdw(LPSTR szIn,LPINT n, LPINT code, LPINT flags, LPSTR szFilename); where szIn is a pointer to a string containing the text which is to be converted into the barcode; n is the number of characters in the string (or 0 – in which case the string may not contain NULL characters), code specifies the barcode type flags sets barcode characteristics szFilename is a pointer to a string which contains the fully qualified pathname of a file to receive the string of characters which represent the barcode when rendered in the PDF font. Returns the number of characters written to file, or 0 if function fails. Basic declaration Private Declare Function BarCdw Lib "dlunif" (ByVal szIn As String, ByRef n As Long, ByRef cd As Long, ByRef fl As Long, ByVal szFilename As String) As Long

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  9

Functions for setting and using default characteristics Another group of functions enable a set of default barcode characteristic to be set and subsequent barcodes to be created using those preset properties.

BarAsk() - displays a dialog box allowing the user to specify the default barcode characteristics to be used for subsequent barcodes Declared for C as int WINAPI BarAsk(LPSTR szIn, LPINT ie); where szIn is a pointer to a string containing the text which will be displayed in the data section of the dialog box; this text is NOT stored as default barcode data. ie is a pointer to an integer that enable the barcode data box in the dialog if non zero (enabling the user to change the value). If ie is 0 then the barcode data box is disabled.

The parameters that may be set using the dialog box are: Auto check digit – if checked then barcodes will have their check digits calculated automatically Wide bars – if checked then barcodes that allow a variation in the wide/narrow bar ratio will be created with a ratio of 3:1. If uncheck the default value of 2:1 is used. Extra 1 and Extra 2 – these boxes allow specific properties for barcodes to be specified – see the Barcodes Help for the effects on specific barcode types. GS1 style - When checked the library encodes the data for use with any of the DxxE cosmetic GS1 fonts. May be used for EAN-13, EAN-8, UPC-A, UPC-E, ISBN, ISMN or ISSN barcode types only. For other barcode types an error will be reported. Barcode font – the name and size of the barcode font used to generate the barcode may be selected by pushing the Change button. The Size may be specified EITHER by selecting the height of the barcode font in points (just like any other font) OR by entering the X unit (thickness of the thinnest bar) value in mils (thousandths of an inch).

10  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

Basic declaration Private Declare Function BarAsk Lib "dlunif" (ByVal szIn As String, ByRef n As Long) As Long

BarCdvs() - allows the default barcode characteristics to be set directly. Declared for C as int WINAPI BarCdvs(LPSTR szfname,LPINT fht, LPINT codei,LPINT flagsi); where szfname is the default barcode font name fht is the default font height codei is the default barcode type flagsi is the default barcode characteristics. Basic declaration Private Declare Function BarCdvs Lib "dlunif" (ByVal szFname As String, ByRef fht As Long, ByRef code As Long, ByRef flgs As Long) As Long

BarCdv() - creates text for Universal Barcode Font using the current default barcode characteristics and returns text in szOut Declared for C as int WINAPI BarCdv(LPSTR szIn , LPINT n, LPSTR szOut, LPSTR fname, LPINT fht); where szIn is a pointer to a string containing the text which is to be converted into the barcode; n is the number of characters in the string (or 0 – in which case the string may not contain NULL characters), szOut is a pointer to a string which will receive the characters to be rendered in the barcode font. fname returns the current default barcode font name, and fht returns the current default barcode font height in points. Returns the number of characters in szOut. If the return is negative it represent the negative of an errorcode. Basic declaration Private Declare Function BarCdv Lib "dlunif" (ByVal szIn As String, ByRef n As Long, _ ByVal szOut As String, ByVal szFnt As String, ByRef fntht As Long) As Long

BarCdvc() - creates text for Universal Barcode Font and copies text to the Windows clipboard Declared for C as int WINAPI BarCdvc(LPSTR szIn,LPINT ni); where szIn is a pointer to a string containing the text which is to be converted into the barcode; n is the number of characters in the string (or 0 – in which case the string may not contain NULL characters) Returns 0 if successful, or –1 otherwise. Basic declaration

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  11

Private Declare Function BarCdvc Lib "dlunif" (ByVal szIn As String, ByRef n As Long) As Long

BarCdvw() int WINAPI BarCdvw(LPSTR szIn,LPINT ni, LPSTR szFilename); - creates text for Universal Barcode Font using the current default barcode characteristics and writes text to file szFilename Declared for C as int WINAPI BarCdvw(LPSTR szIn, LPINT ni, LPSTR szFilename); where szIn is a pointer to a string containing the text which is to be converted into the barcode; ni is the number of characters in the string (or 0 – in which case the string may not contain NULL characters), szFilename is a pointer to a string which contains the fully qualified pathname of a file to receive the string of characters which represent the barcode when rendered in the PDF font. Returns the number of characters written to file, or 0 if function fails. Basic declaration Private Declare Function BarCdvw Lib "dlunif" (ByVal szIn As String, ByRef n As Long, _ ByVal szfname As String) As Long

Information functions The following functions are available for information purposes.

BarCdi() - returns the name of a barcode type Declared for C as int WINAPI BarCdi(LPSTR szIn,LPINT ni, LPINT code,LPINT flags,LPSTR name) where szIn is a pointer to a string containing the text which is to be converted into the barcode – may be NULL for this function; n is the number of characters in the string (or 0 – in which case the string may not contain NULL characters), code specifies the barcode type whose name is required flags =0 name is a pointer to a string which receives the name of the barcode type specified by the code parameter. Is NULL is code value not valid. Returns the value of code, or –1 if fails. Basic declaration Private Declare Function BarCdi Lib "dlunif" (ByVal szIn As String, ByRef n As Long, ByRef cd As Long, ByRef fl As Long, ByVal szname As String) As Long This function may be used to fill a listbox with the available barcode type names; e.g. sz$ = "test" x$ = String(24, vbNullChar) tt = 0 fg = 0 For i = 0 To 40

12  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

cd = i n = BarCdi(ByVal sz$, tt, cd, fg, ByVal x$) If (n >= 0) Then Combo1.AddItem (x$) End If Next i

BarCdt() Returns the human readable form of the last barcode created. Declared for C as int WINAPI BarCdt(LPSTR szText) where szText is a pointer to a string which returns with the human readable text – including any calculated check digit and barcode specific formatting – if the call is successful. Note that clocked barcode types do not have a human readable form! Return value is the length of szText, or 0 if an error occurred or if there is no human readable form. Basic declaration Private Declare Function BarCdt Lib "dlunif" (ByVal szText As String) As Long

ErrorMess() The ErrorMess() function is declared in C as Int WINAPI ErrorMess(LPINT errorcode, LPSTR errortext) And is use to obtain in errortext the text string corresponding to the error code pointed to by errorcode. Note that the buffer pointed to by errortext must be declared as at least 36 bytes (ie char errortext[36]) to received the error messages. Basic declaration Private Declare Function ErrorMess Lib "dlunif" (ByRef er As Long, ByVal ertext As String) As Long

Error codes A negative value returned from the BarCdf() call indicates one of the following errors: 1 Invalid data length 2 Invalid code type 3 Invalid parameters 4 Illegal character in data 5 Invalid embedded code 6 size error 7 Font error 8 Error creating image Error creating barcode

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  13

The Uniocx control The UNIOCX control is an Active-X control which simplifies the use of the UniFont barcode fonts. The control does NOT require the presence of the DLL. The UNIOCX control may be placed on a form in most applications which support Active-X controls, such as Visual Basic, Microsoft Access, etc. The barcode properties may be specified through a series of Properties, either via programming, or by setting the properties in the control’s property pages.

Placing the control on a form Visual Basic To add the control to a Visual Basic project select Components from the Project menu, then select UNIOCX Active-X Control module from the list of controls displayed and push the OK button. The module’s icon will appear in the Toolbox. The control may then be added to a form by clicking on the control’s icon and then drawing a rectangle for the control on the required form. If the control is to be visible then the area allowed should be large enough to hold the largest barcode required. If the control is to be hidden, then the size is irrelevant. Once added to a form, selection of the control will show the available properties in Visual Basic’s properties window.

Access To add the control to an Access 2007 Form or Report, open the form or report in Design view and select the Active-X icon on the Controls ribbon. In Access 2010 or later click on the drop-down list icon on the Control ribbon and select Active-X controls from the menu that appears. Then select the UNIOCX Control from the list of controls displayed. Draw a rectangle for the control on the form or report. Once added to a form or report, selection of the control will show the available properties in Access’s properties window. The font should be set by right-clicking on the control and choosing the Uniocx Control Object ….. Properties from the displayed menu.

Office documents In Word and Excel adding an Active-X control requires the Developer ribbon to be visible. In Word 2007 or Excel 2007 you can make the Developer ribbon visible by selecting the Office icon, choosing Word Options/Excel Options, and in the Popular pane checking the checkbox labelled “Show Developer tab in the Ribbon”. For Office 2010/2013 choose Options from the File menu, select Customise ribbon, and check the Developer checkbox in the right-hand pane. An Active Barcode Control may be placed on a Word document by selecting the Controls toolbox on the Developer ribbon. In Excel drop down the Insert item of the Controls ribbon. When the Control toolbox is displayed select More controls from the Active-X Controls section (the bottom-right icon). This opens the More Controls dialog which lists the available Active-X controls. Select Uniocx Control and push the OK button [or double-click on the Uniocx Control entry]. An Empty rectangle will appear on the document. To set the barcode properties right-click on the rectangle and choose the Uniocx Control Object ….. Properties item from the displayed menu. When you have set the properties turn off Design mode to make the barcode visible.

14  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

Property pages The control also has its own property pages which may be accessed by right-clicking on the control and selecting Properties from the displayed menu.

General Property page This permits the setting of the barcode’s data, code type and other properties, and allows the control to be set to resize itself each time it is drawn

Font Property page This page allows the user to select the barcode font and font size used to generate the barcode.

Colors Property page This page allows the user to specify the foreground (the bars) and background color of the barcode generated. In general barcodes should be produced with a black foreground and a white background color.

The Control’s Properties The control has the following control properties which may be set in the property pages or programmatically with Visual Basic.

Caption: (BSTR) the data which will be converted into a barcode AutoCheckDigit: (Boolean) if non-zero causes the control to calculate the barcode's check digit. If 0 (False) no check digit calculation is performed, and it is assumed that the check digit(s) are in the Caption data. Note that this property is ignored for Code 128 and EAN128 barcodes, where the check digit is both required and hidden from the user AutoSize: (Boolean) if non-zero causes the control to resize itself to contain the barcode. BackColor: (Colorref) the background color CapLength: (integer) normally 0, in which case the length of the data string in the Caption property is determined automatically. If non-zero it is taken to be the number of characters in the Caption property to be used as data. CodeType: a value which specifies the type of barcode to be produced. (See Barcode types for list of types) Errorcode: (integer) a non-zero value is returned if the data supplied in the Caption property can be converted into a valid barcode. Font: (Font) the font in which the Ouput characters will be displayed ForeColor: (Colorref) the color of the bars in the barcode Extra1: (integer) A flag for setting a specific barcode-dependent characteristic (see the individual barcode type description for details). Set to 0 if not required. Extra2: (integer) A flag for setting a specific barcode-dependent characteristic (see the individual barcode type description for details). Set to 0 if not required. Human: (Cstring) the human readable form for the last barcode translation performed. Note that clocked barcodes do not have a human readable form. Mode: (integer) When 0 encoding is for the Universal (UNxx) fonts; when non-zero encoding if for the DxxE cosmetic GS1 fonts. Output: (CString) the characters which when displayed in the correct font, produce the barcode. Note that this string may be much larger than the Caption string.

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  15

In addition the control supports the normal Active-X properties, such as Visible, Height, Width, etc.

The Control’s Methods TypeName(iCodeType) Implemented as a Get method. String name=TypeName(iCodeType) To interrogate the list of barcode types supported by the control the TypeName(iCodeType) method may be used. This returns a string (BSTR) containing the name of the barcode that corresponds to a CodeType of iCodeType. An empty string is returned if iCodeType is outside the range of values supported. A complete list of the code types supported is shown in the Barcodes HELP file supplied with this product. An Visual Basic example of filling a listbox with the names of barcode types is shown below: For i = 0 To 80 x$ = Uniocx1.TypeName(i) If Len(x$) < 2 Then GoTo donelb codetype.AddItem (x$) Next I donelb: codetype.ListIndex = 8

BarCopy() Copies the current barcode translation to the Windows clipboard, from where it may be pasted into other applications. After pasting the pasted text may be set to the required Unifont font to produce the barcode. The Method always returns 0.

BarSave(filename) Saves the current barcode translation to a text file. The full pathname of the text file must be provided in the filename parameter. The method returns the number of characters in the file, or 0 if an error occurred.

16  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

GetError() The GetError(Errorcode) method returns the text (a BSTR string) of the error message corresponding to the Errorcode value. So a string variable may be filled with the error message using X$=Uniocx1.GetError(Uniocx.Errorcode) Where the Errorcode value is that shown in the Error codes table.

ShowProps() The ShowProps methods causes the display of the control’s property pages, allowing the user to set the properties of a barcode.

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  17

Uninet .NET component The Universal Barcode Font Kit includes a .NET Component (uninet, in the DLL uninetLib.dll) which is a managed code component that allows barcode strings to be created within the user’s own .NET application. Single computer versions of the component are useable only on a single computer. Developer versions permit applications built with the uninet.NET component to be distributed up to a maximum distribution of 10,000 copies. Developer versions requires the developer’s serial number to be passed to the component using the SerialNo property. The uninet.NET Component is designed to work with Visual Studio.NET and requires the .NET run-time to be installed on any computer using the components. Example code is provided for users of Visual Basic .NET.

Uninet barcode types table The CodeType and CodeTypeValue properties available in the Uninet component are shown in the table below. Barcode Code 39 Extended Code 39 Codabar 2 of 5 Interleaved 2 of 5 Matrix 2 of 5 Code 93 Extended Code 93 Code 128 GS1 128 SSCC EAN 14 EAN 13 EAN 13 + 2 digits EAN 13 + 5 digits EAN 8 EAN 8 + 2 digits EAN 8 + 5 digits UPC-A UPC-A + 2 digits UPC-A + 5 digits UPC-E MSI/Plessey Plessey DeutschenPost PostNet Planet 12 Planet 14 Royal Mail 4-State ISBN ISSN ISMN TelePen Standard

18  Universal Barcode Fonts

CodeType Code_39 Extended_39 Codabar Standard_2_of_5 Interleaved_2_of_5 Matrix_2_of_5 Code_93 Extended_93 Code_128 GS1_128 SSCC EAN_14 EAN_13 EAN_13_plus_2 EAN_13_plus_5 EAN_8 EAN_8_plus_2 EAN_8_plus_5 UPC_A UPC_A_plus_2 UPC_A_plus_5 UPC_E MSI_Plessey Plessey DeutschePost PostNet Planet_12 Planet_14 RM4SCC FourState ISBN ISSN ISMN Telepen

CodeTypeValue 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

dLSoft Universal Barcode Font Kit

TelePen ASCII TelePen Numeric Japan Postal code Code 11 Code B ITF-6 ITF-14 IATA 2 of 5 China Post OneCode Code 128 Type A Code 128 Type B UPC-E0 UPC-E1 Korean Postal Authority Italia Post 2/5 Italia Post 3/9 Australia Post InfoMail A PZN Databar Omnidirectional Databar Truncated Databar Limited Databar Expanded IMTM Package Barcode

TelePenA TelepenN Japan_Post Code_11 Code_B ITF_6 ITF_14 IATA_2of5 China_Post ONE_Code Code_128A Code_128B UPC_E0 UPC_E1 KoreanPA Italia25 Italia39 AustraliaPost InfoMail_A PZN Databar_Omnidir Databar_Truncated Databar_Limited Databar_Expanded IM_Package_Barcode

34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58

Using uninet.NET Visual Studio.NET Adding uninet.NET to the ToolBox To add uninet to the Visual Studio ToolBox, display the ToolBox and select the Components tab. Right click on the Components pane and select Add/Remove Items (Choose Items for Visual Studio 2005) from the pop-up menu displayed. A dialog box is displayed listing the currently installed components. Ensure that the .NET Framework Components page is displayed. Push the Browse button and navigate to the location where you have installed or copied your uninet.NET component and select the DLL (e.g. uninetLib.dll). Then push the Open button. The list of installed components is now displayed, including your uninet.NET component. Ensure that the checkbox alongside the component name is checked. Now push the OK button. The component appears as an icon on the ToolBox Components pane, with the class name (uninet) alongside:

Adding a uninet.NET component to a project. With a project's form open in design mode drag the uninet.NET component icon from the toolbox onto the form. The component icon appears on the panel below the form – it does NOT appear on the form itself. The instance of the component will be given a default name (eg Uninet1) which appears in the properties panel when the component is selected. A single Form may contain any number of uninet.NET Components. The first to be added will be called

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  19

Uninet1, the second Uninet2, and so on; the names may be changed by the user by modifying the Name property within the Properties box. The properties panel also displays all other settable properties for the component, and these values will be used as defaults unless properties are changed programmatically within your project.

Setting and retrieving property values programmatically The uninet.NET Component may be operated entirely by setting or retrieving Property values programmatically. Clicking on the uninet Component in the panel under the form when Visual Studio's Properties box is displayed will show the current settings for component's available properties. Most of these may be edited using the Properties box, or may have their values set from within the user's program by statements of the kind Uninet1.Caption="12345"

Visual Basic

Uninet1.Caption="1234";

C#

Uninet1.set_Caption("1234");

J#

uninet Component properties that are set AFTER a barcode has been created may be retrieved within user's programs by statements of the kind: x=Uninet1.Error

Visual Basic

x=Uninet1.Error;

C#

x=Uninet1.get_Error()

J#

Licensing the .NET component uninet.NET component will behave as a Testware version (generating scrambled barcodes and pattern strings) unless correctly licensed. Single computer version of the components are licensed for use only on a single computer. Developer versions permit applications built with the uninet.NET components to be distributed up to a maximum distribution of 10,000 copies. Developer versions require the developer’s serial number to be passed to the component using the Serial property before the Barcode() method is called. The Serial property should be set to the serial number provided for your product, e.g. Uninet1.SerialNo="12345" for VB Uninet1.SerialNo="12345"; for C# Uninet1.set_SerialNo("12345"); for J#

Properties The following properties are required - although all are provided with default values.

AutoCheckdigit Type: BOOL Default: FALSE Allowed values: FALSE (check digit characters not calculated) TRUE (check digit characters calculated and appended to code for appropriate code types)

20  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

This property is ignored for Code 128, EAN 128, Planet and Postnet codes where the check digit is mandatory and not available in human readable form.

BarRatio Type: float Default 2.0 Allowed values: 2.0 – 3.0 This setting allows some barcode types to have the Wide bar/Narrow bar ratio modified. Applies mainly to Code 39 and Interleaved 2 of 5 barcodes. Although this property is a float type, in the current version the value will be converted to the nearest integer value of 2 or 3.

Caption Type: string Default:

"12345"

Allowed values: Any text string. Note: only text strings recognised as valid barcodes will result in a barcode picture. An Illegal character in the text string will cause an Error value to be set.

CodeType Type: bCode enumeration member For uninet.NET Component Universal Default:

Code_39

Allowed values: The ranges of values defined for the individual components are shown in the barcode type tables below. The barcode type can be set using either the CodeType property or the CodeTypeValue property shown in the table above.

CodeTypeValue Type: integer Default:

0

Allowed values: The ranges of values defined for the individual components are shown in the barcode type tables below. The barcode type can be set using either the CodeType property or the CodeTypeValue property. The available values are shown in the table above.

Extra1 Type: BOOL Default FALSE These additional properties are not normally used. However, they do provide additional functions for a limited number of specific barcode types. See Barcodes section for details.

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  21

Extra2 Type: BOOL Default FALSE These additional properties are not normally used. However, they do provide additional functions for a limited number of specific barcode types. See Barcodes section for details.

Font Type: FONT Default:

UNCW 36 point Regular

Allowed values: One of UNAx, UNBx, UNCx, UNDx, UNEx, UNFW, with appropriate font height and style properties. (x may be W, R, or N. R and N are reduced width bars to allow for printer problems and/or ink spread). These fonts should be used when GS1style is set to FALSE. Also allowed are: DBWE EANUPCDBRE EANUPC DCWE EANUPCDCRE EANUPC These fonts may be used to generate cosmetic GS1 symbols, including the human readable text and elongated start, centre and stop bars, and may only be used if GS1style is set to TRUE. Note that this property is not used by the component and is provided simply as a way of storing and retrieving a font in which to display or print the barcode.

GS1style Tyep: BOOL Default: FALSE When FALSE the component encodes data for use with one of the Universal (UNxx) fonts. When set to TRUE the component encodes GS1 data for use with one of the cosmetic GS1 (DxxE) fonts.

Information properties Note that the barcode symbol is determined only when one of the getBarcode() or getBarcode2() methods are called, so the information properties are not available until this method has been called.

Error Type: integer Returns a value representing the error code if a valid barcode image cannot be created. Otherwise returns 0. Read only. Do not set this property. The error codes and corresponding Status property values are shown below:

Status Type: string Returns a string interpreting the value of the Error property. The error codes and corresponding Status property values are shown below:

22  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

Error

Status

0

OK

1

Illegal character in data

2

Wrong data length

3

Error in barcode data

9

Unknown error

Read only. Do not set this property.

Pattern Type: String Returns: A string containing a pattern of 0s and 1s, where 0 represents a space of minimum width and a 1 represents a bar of minimum width. The 1s may be used to indicate that a bar (filled rectangle) must be drawn. Read only. Do not set this property.

String2 Type: string Returns the Caption property plus any additional characters generated as check digits. Read only. Do not set this property.

Methods getBarcode() parameters: none Return type: String Returns the string of characters which, when displayed or printed using one of the Universal Fonts, forms the barcode.

getBarcode2() parameters: String – input data Return type: String Returns the string of characters which, when displayed or printed using one of the Universal Fonts, forms the barcode. The data is taken from the input parameter. Barcode=getBarcode2(szin) is equivalent to setCaption(szin); Barcode=getBarcode();

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  23

24  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

The 2D Barcode Fonts & Tools TrueType fonts named AZTx, PD2x, PD3x, PD4x and PD5x will be installed, where x represent a character that identifies the weight of the font. The fonts named AZTx are used for the display or printing of Aztec, Datamatrix, QR Code and Micro QR Code symbols. There are AZTx characters corresponding to the characters 0 to z (ASCII 48 – 122). [The character corresponding to the grave accent (ASCII 96) is reproduced at the position of quoteleft (ASCII 145).] Each character represents a 2 * 3 matrix of barcode elements. The fonts named PD2x, etc. are used for the display or printing of PDF417, Micro PDF417 and Truncated PDF417 Code symbols. There are PDnx characters corresponding to the characters 0 to z (ASCII 48 – 122). [The character corresponding to the grave accent (ASCII 96) is reproduced at the position of quoteleft (ASCII 145).] Each character represents a linear array of 6 barcode elements. The height to width ratio of each element in the PDnx fonts is indicated by the value of n; eg. PD3W fonts have each element height 3 times the element width. PDF 417 symbols may have element height to width ratios of 2 – 5. Font names containing the letter W (eg. AZTW) are precisely the correct size for use on most common printers. Fonts containing the letters R (reduced) or N (narrow) have their dimensions reduced by 5% and 10% respectively to allow for ink spread on certain types of printers. These latter fonts should only be used if your printing technology requires this. The fonts can only be used in association with one of the supporting components (detailed below) which convert the barcode data into a multi-line string of characters that form the symbol when displayed or printed in the appropriate font.

The U2DDFU DLL The 32 bit and 64 bit DLLs differ in name but are functionally equivalent. The 32 bit DLL is U2DDFU.DLL or U2DDF.DLL and the 64 bit version is U2DDF64U.DLL or U2DDF64.DLL. In the description that follows only the 32 bit U2DDF.DLL name will be used, but the comments apply equally to the Unicode and 64 bit versions. To convert a string of characters into the bars and spaces required for the barcode requires converting the character string into another string – made up of only the 0 - z characters present in the one of the supplied fonts. The U2DDF.DLL will perform this conversion, and provides three function calls which can either return the required string, copy it to the clipboard, or save it to a named disk file. These functions may be called from Visual Basic (including Visual Basic for Applications in Microsoft Office), Visual C++, Visual Foxpro, Delphi, C++ Builder, and in fact virtually every language that can make DLL calls. The functions are called with parameters that specify the options available for the barcode: codeType – a pointer to an integer that represents the barcode type required. The allowed values are listed in the appendix: szIn – is a pointer to a string containing the bytes used as data to create the barcode. While passed as a text string, the string can contain non-text bytes (including ASCII 0) provided that the length parameter (n) is used to specify the length of the data. If n is 0, then the string is assumed to be a null-terminated ASCII string. n – a pointer to an integer which is either 0 or specified the length of the data in szIn. columns – a pointer to an integer may be used to specify the number of codeword columns to be used in PDF417, Micro PDF417 or Truncated PDF417 symbols (ignored for other barcode types). level – a pointer to an integer specifying the security level of the barcode generated. Allowed values are listed in the appendix. mode – a pointer to an integer specifying the mode of barcode created. The allowed values are listed in the appendix. flag – a pointer to an integer specifying the value of the flag variable.

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  25

szOut – a pointer to a string that will receive that output string.

2D Function calls The available function calls are:

BarsOut2D() Create a barcode in the device context hdc at the coordinates xin,yin (in MM_TEXT units) using the parameters specified. Declared for C as

int WINAPI BarsOut2D(HDC hdc,int xin, int yin, LPTSTR szIn, int code, int flag, int columns, int mode, int level, int fontsize,LPTSTR fontname); where szIn is the data to be encoded, code is an integer specifying the barcode type, mode is an integer specifying the mode for the barcode, flags is an integer specifying flag setting, columns is an integer specifying the number of columns in the barcode (for those code types that support this), level is an integer specifying the security level for the barcode (for those code types that support this), fontname points to a string specifying the font used in creating the barcode, and fontsize is an integer specifying the height of that font (in Points). The return value is 0 is the function is successful or an error code if the function fails.

Bar2DUf () - creates text for the barcode font and returns text in szOut Declared for C as int WINAPI Bar2DUf(LPINT codetype, LPSTR szIn,LPINT n, LPINT columns, LPINT level, LPINT mode, LPINT flag, LPSTR szOut); where szOut is a pointer to a string which will receive the characters to be rendered in the PDF font. The buffer pointed to must exist and be large enough to hold the returned string. The return value is a positive integer if the function succeeds, its value representing the length of the created string. A negative value indicates an error – the absolute value of which is the error code (see the ErrorMess2D() function). VB6 Basic declaration Private Declare Function Bar2DUf Lib "u2ddf" (ByRef ct as Long, ByVal szIn As String, ByRef n As Long, ByRef co As Long, ByRef lv As Long, ByRef mo As Long, ByRef fl As Long, ByRef szOut As String) As Long

Bar2DUf2 () - creates text for the barcode font and returns text in szOut. Barcode properties (apart from the data) are those stored in memory. Declared for C as int WINAPI Bar2DUf2( LPSTR szIn, LPSTR szOut); where szOut is a pointer to a string which will receive the characters to be rendered in the PDF font. The buffer pointed to must exist and be large enough to hold the returned string.

26  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

The return value is a positive integer if the function succeeds, its value representing the length of the created string. A negative value indicates an error – the absolute value of which is the error code (see the ErrorMess2D() function). VB6 Basic declaration Private Declare Function Bar2DUf2 Lib "u2ddf" (ByVal szIn As String, ByRef szOut As String) As Long

Bar2DUc () - creates text for the barcode font and copies text to the Windows clipboard Declared for C as int WINAPI Bar2DUc(LPINT codetype, LPSTR szIn,LPINT n, LPINT columns, LPINT level, LPINT mode, LPINT flag); The function return -1 if it succeeds or 0 if it fails. VB6 Basic declaration Private Declare Function Bar2DUc Lib "u2ddf" (ByRef ct as Long, ByVal szIn As String, ByRef n As Long, ByRef co As Long, ByRef lv As Long, ByRef mo As Long, ByRef fl As Long) As Long

Bar2DUw () - creates text for the barcode font and writes text to file szFilename Declared for C as int WINAPI Bar2DUw((LPINT codetype, LPSTR szIn, LPINT n, LPINT columns, LPINT level, LPINT mode, LPINT flag, LPSTR szFilename); where szFilename is a pointer to a string that contains the full pathname of the file to receive the text. If the file exists it will be overwritten. If it does not exist it will be created if possible. The return value is a positive integer if the function succeeds, its value representing the number of bytes written to the file. A negative value indicates an error – the absolute value of which is the error code (see the ErrorMess2D() function). VB6 Basic declaration Private Declare Function Bar2DUw Lib "u2ddf" (ByRef ct as Long, ByVal szIn As String, ByRef n As Long, ByRef co As Long, ByRef lv As Long, ByRef mo As Long, ByRef fl As Long, ByRef szFilename As String) As Long

BarAsk2DU Displays the Barcode Properties dialog box using the data provided in the data parameter. All other barcode properties are those stored in memory (see BarAsk2DUEx). Declared for C as int WINAPI BarAsk2DU( LPSTR data, LPINT bStore); where data is a pointer to a buffer containing the barcode data to initialise the dialog. If the user closes the dialog by pushing the OK button the data currently displayed in the dialog box is copied back to the buffer pointer to by data. This buffer must be large enough to receive the data. bStore is a pointer to an integer. If the integer is non-zero then the barcode properties displayed in the dialog box when the user pushes the OK button become the default properties for barcode creation for future instances of the program. If the integer is zero then the barcode properties remain in memory while the library is loaded but will be lost when the calling program exits. The return value is -1 if the user pushes the OK button, or 0 if the user pushes the Cancel button.

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  27

VB6 Basic declaration Private Declare Function BarAsk2DU Lib "u2ddf" (ByVal szData As String, ByRef bStore as Long) As Long

BarAsk2DUEx Displays the Barcode Properties dialog box using the data and barcode properties provided in the parameters.

Declared for C as int WINAPI BarAsk2DUEx( LPINT codetype, LPINT modetype, LPINT columns, LPINT level, LPINT flag, double* fontheight, LPSTR fontname, LPSTR data, LPINT bStore); where data is a pointer to a buffer containing the barcode data to initialise the dialog. If the user closes the dialog by pushing the OK button the data currently displayed in the dialog box is copied back to the buffer pointer to by data. This buffer must be large enough to receive the data. Fontheight is a pointer to a double variable containing the height of the font (in points) of the barcode font displayed in the dialog. Fontname is a pointer to a buffer that contains the name of the barcode font that will be displayed in the dialog. bStore is a pointer to an integer. If the integer is non-zero then the barcode properties displayed in the dialog box when the user pushes the OK button become the default properties for barcode creation for future instances of the program. If the integer is zero then the barcode properties remain in memory while the library is loaded but will be lost when the calling program exits. The return value is -1 if the user pushes the OK button, or 0 if the user pushes the Cancel button. VB6 Basic declaration

28  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

Private Declare Function BarAsk2DUEx Lib "u2ddf" (ByRef ct as Long, ByRef mo As Long, ByRef co As Long, ByRef lv As Long, ByRef fl As Long, ByRef fht As Double , ByVal fname As String, ByVal szData As String, ByRef bStore as Long) As Long

Bar2DUin Bar2DUin copies the parameters into memory. Parameters in memory may be accessed or used by the Bar2DUrd(), BarAsk2DU() and Bar2DUf2() functions. Declared for C as int WINAPI Bar2DUin(LPINT codetype, LPINT modetype, LPINT columns, LPINT level,LPINT flag, double * fontheight, LPSTR fontname, LPINT bStore); bStore is a pointer to an integer. If the integer is non-zero then the barcode properties displayed in the dialog box when the user pushes the OK button become the default properties for barcode creation for future instances of the program. If the integer is zero then the barcode properties remain in memory while the library is loaded but will be lost when the calling program exits. The function always returns 0. VB6 Basic declaration Private Declare Function Bar2DUin Lib "u2ddf" (ByRef ct as Long, ByRef mo As Long, ByRef co As Long, ByRef lv As Long, ByRef fl As Long, ByRef fht As Double , ByVal fname As String, ByRef bStore as Long) As Long

Bar2DUrd Bar2DUrd fills the variables pointed to by the parameters with the corresponding barcode property values currently in memory. Declared for C as int WINAPI Bar2DUrd(LPINT codetype, LPINT modetype, LPINT columns, LPINT level,LPINT flag, double * fontheight, LPSTR fontname); The function always returns 0. VB6 Basic declaration Private Declare Function Bar2DUrd Lib "u2ddf" (ByRef ct as Long, ByRef mo As Long, ByRef co As Long, ByRef lv As Long, ByRef fl As Long, ByRef fht As Double , ByVal fname As String) As Long

EnumCode2D() Enumerates the names of the barcode types supported. Declared for C as int WINAPI EnumCode2D((LPINT codetype, LPSTR szName); where codetype is a pointer to an integer containing the codetype value of the barcode type being queried, szName is a pointer to a buffer that will receive the name of the corresponding barcode type. The buffer must exist and have space for at least 36 characters. Calls to EnumCode2D return the value of codetype if successful, or -1 if the call fails (ie. If there is no corresponding barcode type supported). VB6 Basic declaration

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  29

Private Declare Function EnumCode2D Lib "u2ddf" (ByRef ct as Long, ByVal szName As String) As Long

EnumMode2D() Enumerates the names of the barcode modes supported for a specified code type. Declared for C as int WINAPI EnumMode2D((LPINT codetype, LPINT mode, LPSTR szName, LPINT levels); where codetype is a pointer to an integer containing the codetype value of the barcode type being queried, mode is a pointer to an integer containing the mode value of the barcode mode being queried, szName is a pointer to a buffer that will receive the name of the corresponding barcode mode. The buffer must exist and have space for at least 36 characters. Levels is a pointer to an integer that will receive the number of security levels available for the specified mode. Calls to EnumMode2D return the value of mode if successful, or -1 if the call fails (ie. If there is no corresponding mode supported). VB6 Basic declaration Private Declare Function EnumMode2D Lib "u2ddf" (ByRef ct as Long, ByRef mode as Long, ByVal szName As String, ByRef lev as Long) As Long

ErrorMess2D() The ErrorMess2D() function call to the DLL is used to obtain in human readable text string corresponding to the error code returned by other function calls. Declared for C as Int WINAPI ErrorMess2D(LPINT errorcode, LPSTR errortext) errortext receives a text string corresponding to the error code pointed to by errorcode. Note that the buffer pointed to by errortext must be declared as at least 36 bytes (ie char errortext[36]) to received the error messages. VB6 Basic declaration Private Declare Function ErrorMess2D Lib "u2ddf" (ByRef n As Long, ByRef ss As String) As Long

MaxLevel2D() MaxLevel2D returns the number of security level provided by symbols of type codetype when in mode modetype. Declared for C as int WINAPI MaxLevel2D(LPINT codetype, LPINT modetype) if there is no symbol corresponding to codetype and modetype the function returns -1; VB6 Basic declaration Private Declare Function MaxLevel2D Lib "u2ddf" (ByRef ct As Long, ByRef mo As Long) As Long

30  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

The U2Docx Control The U2DOCX control is an Active-X control which simplifies the use of barcodes in Active-X containers such as Visual Basic and Microsoft Access. The U2DOCX control may be placed on a form in most applications which support Active-X controls, such as Visual Basic, Microsoft Access, etc. The barcode properties may be specified through a series of Properties, either via programming, or by setting the properties in the control’s property pages.

Placing the control on a form Visual Basic To add the control to a Visual Basic 6 project select Components from the Project menu, then select U2DOCX Active-X Control module from the list of controls displayed and push the OK button. The module’s icon will appear in the Toolbox. The control may then be added to a form by clicking on the control’s icon and then drawing a rectangle for the control on the required form. If the control is to be visible then the area allowed should be large enough to hold the largest barcode required. If the control is to be hidden, then the size is irrelevant. Once added to a form, selection of the control will show the available properties in Visual Basic’s properties window.

Access To add the control to an Access 2007 Form or Report, open the form or report in Design view and select the Active-X icon on the Controls ribbon. In Access 2010 or later click on the drop-down list icon on the Control ribbon and select Active-X controls from the menu that appears. Then select the U2DOCX Control from the list of controls displayed. Draw a rectangle for the control on the form or report. Once added to a form or report, selection of the control will show the available properties in Access’s properties window. The font should be set by right-clicking on the control and choosing the U2docx Control Object ….. Properties from the displayed menu.

Office documents In Word and Excel adding an Active-X control requires the Developer ribbon to be visible. In Word 2007 or Excel 2007 you can make the Developer ribbon visible by selecting the Office icon, choosing Word Options/Excel Options, and in the Popular pane checking the checkbox labelled “Show Developer tab in the Ribbon”. For Office 2010/2013 choose Options from the File menu, select Customise ribbon, and check the Developer checkbox in the right-hand pane. An Active Barcode Control may be placed on a Word document by selecting the Controls toolbox on the Developer ribbon. In Excel drop down the Insert item of the Controls ribbon. When the Control toolbox is displayed select More controls from the Active-X Controls section (the bottom-right icon). This opens the More Controls dialog which lists the available Active-X controls. Select U2docx Control and push the OK button [or double-click on the U2docx Control entry]. An Empty rectangle will appear on the document. To set the barcode properties right-click on the rectangle and choose the U2docx Control Object ….. Properties item from the displayed menu. When you have set the properties turn off Design mode to make the barcode visible.

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  31

Property pages The control also has its own property pages which may be accessed by right-clicking on the control and selecting Properties from the displayed menu.

General Property page This permits the setting of the barcode’s type, mode and security level properties, and allows the control to be set to resize itself each time it is drawn

Data Property page The edit box on this page shows the data currently being used to generate the barcode image. It is useful only for displayable characters. To provide data which includes non-printable characters the Caption property should be set via programming.

Font Property page This page allows the user to select the barcode font and font size used to generate the barcode.

Control Properties The control has the following properties which may be set in the property pages or programmatically with Visual Basic. AutoSize: (Boolean) if non-zero causes the control to resize itself to contain the barcode. Caption: (BSTR) the data which will be converted into a barcode CapLength: (integer) normally 0, in which case the length of the data string in the Caption property is determined automatically. If non-zero it is taken to be the number of characters in the Caption property to be used as data. CodeType: (integer) the value specifying the type of barcode to be generated (see the appendix for allowed values). Columns: (integer) the value specifying the number of codeword columns in PDF417, MicroPDF417 or Truncated PDF417 symbols. Errorcode: (integer) a non-zero value is returned if the data supplied in the Caption property can be converted into a valid barcode. Font: (Font) the font in which the Output characters will be displayed

32  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

Flag: (integer) If bit 7 is set then Unicode encoding is performed. If bit 6 is set for the Datamatrix codetype then a PostMatrix symbol is generated. If bit 9 is set for the Datamatrix codetype then a DeutschePost symbol is generated. If bit 1 is set for Datamatrix or QR Code symbols, then GS1 encoding is used. SecurityLevel: (integer) the security level for the generated barcode (see the appendix for allowed values) StartMode: (integer) the mode used to generate the barcode (see the appendix for allowed values) Output: (CString) the characters which when displayed in the correct font, produce the barcode. Note that this string may be much larger than the Caption string. In addition the control supports the normal Active-X properties, such as Visible, Height, Width, etc.

Control methods The following methods are provided by the Active-X control.

BarSave() Int BarSave(LPSTR filename) Causes the control to save the barcode characters into a text file. Filename must be the fully qualified file name, complete with .TXT extension – such as that available from the Windows SaveDialog control. The methods returns the number of bytes saved in the file, or 0 if an error occurs. VB6 Example: Ff$=”C:\test.txt” BarSave(Ff$)

BarCopy() Int BarCopy(void) Copies the barcode text to the Windows clipboard, from where it may be pasted into other applications. Note that only the text is copied; pasted text will need to be set into the appropriate font before a barcode will be seen. VB Example BarCopy()

GetModeName() BSTR GetModeName(LPINT codetype, LPINT mode) where the codetype parameter contains the barcode type value and mode contains the mode value for the mode whose name is required. Return the name of the mode for the barcode type. For example, DataMatrix barcodes have the mode name “Square” for mode=0 and “Rectangular” for mode=1. An invalid value in mode will return an empty string, so this method may be used for enumerating the available modes; for example: CodeT=0 For i = 0 To 10 x$ = Aztocx1.GetModeName(CodeT,i) If (Len(x$) > 0) Then

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  33

Combomode.AddItem (x$) Else Exit For End If Next

GetMaxLevel() Int GetMaxLevel(LINT code. LPINT mode) where the codetype parameter contains the barcode type value and mode contains the mode value for the mode whose maximum number of security levels is required. Returns the number of security levels valid for the mode. For example, Aztec in Normal mode can have 99 levels, but in Compact mode has only 4. VB Example CodeT=0 Mode=0 N=GetMaxLevel(CodeT,Mode)

GetError() BSTR GetError(LPINT errorcode) The GetError(Errorcode) method returns the text (a BSTR string) of the error message corresponding to the Errorcode value. So a string variable may be filled with the error message using X$=Uniocx1.GetError(Uniocx.Errorcode)

ShowProps() A call to ShowProps() displays the control’s Property Pages which allow the barcode properties, its data and the font used to create the barcode symbol to be specified.

34  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

U2Dnet .NET component Using the .NET Component in Visual Studio Adding a .NET Component to the ToolBox To add a 2D-Font kit Component to the Visual Studio ToolBox, display the ToolBox and select the Components tab. Right click on the Components pane and select Add/Remove Items.. from the pop-up menu displayed. A dialog box is displayed listing the currently installed components. Ensure that the .NET Framework Components page is displayed. Push the Browse button and navigate to the location where you have installed or copied your .NET component and select the U2DNET.DLL. Then push the Open button. The list of installed components is now displayed, including your 2D-font.NET component. Ensure that the checkbox alongside the component name is checked. Now push the OK button. The component appears as an icon on the ToolBox Components pane, with the name u2dnet alongside: Note: Developer versions require the developer’s serial number to be passed to the component using the Serial property before the Barcode() method is called. The Serial property should be set to the serial number provided for your product, e.g. U2Dnet1.Serial="12345" for VB U2Dnet1.Serial="12345"; for C# U2Dnet1.set_Serial("12345"); for J# Use of an incorrect serial number will result in randomly scrambled symbols.

Adding a .NET component to a project. With a project's form open in design mode drag the .NET component icon from the toolbox onto the form. The component icon appears on the panel below the form – it does NOT appear on the form itself. The instance of the component will be given a default name (eg U2Dnet1) which appears in the properties panel when the component is selected. A single Form may contain any number of .NET Components. The first to be added will be called U2Dnet1, the second U2Dnet2, and so on; the names may be changed by the user by modifying the Name property within the Properties box. The properties panel also displays all other settable properties for the component, and these values will be used as defaults unless properties are changed programmatically within your project.

Setting and retrieving property values programmatically The .NET Components may be operated entirely by setting or retrieving Property values programmatically. Clicking on the Barcode Component in the panel under the form when Visual Studio's Properties box is displayed will show the current settings for component's available properties. Most of these may be edited using the Properties box, or may have their values set from within the user's program by statements of the kind U2Dnet1.Caption="123456789"

Visual Basic

U2Dnet1.Caption="123456789";

C#

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  35

The Component properties that are set AFTER a barcode has been created may be retrieved within user's programs by statements of the kind: x=U2Dnet1.Error

Visual Basic

x=U2Dnet1.Error;

C#

Setting properties through the Barcode properties dialog box Using the Method Properties() causes the Barcode properties dialog to be displayed. This displays all settable properties in a convenient form and enables changes to be made by selecting from drop-down lists or entering values into edit boxes.

Displaying a barcode on a form To display a barcode on a form a TextBox is used to hold the characters and the Font property of the TextBox set to a suitable size of the relevant font (eg. AZTW or PD3W).

For example: Private Sub DoBarcode() Visual Basic Abcnet1.Caption="123456789 TextBox1.Texte=U2Dnet1.Barcode() End Sub private void DoBarcode() { U2Dnet1.Caption="123456789"; textBox1.Text=U2Dnet1.Barcode(); }

C#

Printing a barcode

36  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

Printing the text returned by the Barcode() call may be accomplished by any of the printing techniques available for Visual Studio.NET project. However, probably the most useful approach is to use the DrawString() method in a PrintPage handler as illustrated below, and in the example provided with the components:

Visual Basic Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage Dim br As Brush Dim ff As New Font(“AZTW”, 8, FontStyle.Regular) br = New SolidBrush(Color.Black) e.Graphics.PageUnit = GraphicsUnit.Document ' e.Graphics.DrawString(U2Dnet1.barcode(), ff, br, 100.0F, 300.0F) ' Indicate that this is the last page to print. e.HasMorePages = False End Sub While the PageUnit setting can be any of the allowed values, the example above uses the highest resolution setting (Document, equivalent to 300 units per inch).

Licensing the component The .NET components will behave as Testware versions (generating scrambled barcode and pattern strings) unless correctly licensed. Single computer version of the components are licensed for use only on a single computer. Developer versions permit applications built with the.NET components to be distributed up to a maximum distribution of 10,000 copies. Developer versions require the developer’s serial number to be passed to the component using the Serial property before the Barcode() method is called. The Serial property should be set to the serial number provided for your product, e.g. U2Dnet1.Serial="12345" for VB U2Dnet1.Serial="12345"; for C#

.NET Component Properties ByteNumber Type: integer Default: 0 Allowed values: 0 – barcode byte capacity When ByteValue is greater than 0 the Caption string (which is a Unicode string) is unpacked into 8-bit ASCII characters before the data is used to generate the barcode.

Caption Type: string Default:

"0123456789"

Allowed values: Any text string. Note: only text strings recognised as valid barcodes will result in a barcode picture. An Illegal character in the text string will cause an Error value to be set.

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  37

CodeType Type: bCode enumeration member Default:

bCode.PDF417

Allowed values: bCode.Aztec, Datamatrix, PDF417, Micro_PDF, Truncated, QR_Code, Micro_QR

CodeTypeValue Type: integer Default:

0

Allowed values: see appendix The barcode type can be set using either the CodeType property or the CodeTypeValue property.

DeutschePost Type: Boolean Default: false Allowed values: true or false Applies to Datamatrix code type only. When set to True a Datamatrix sumbol is encoded using Base 256 encoding as required by some DeutschePost applications.

Flag Type: Boolean Default: false Allowed values: true or false When Flag is set to true the Caption data is treated as a Unicode string and converted to a byte stream. When Flag is false the Caption data is handled as described for the ByteNumber property.

GS1Flag Type: Boolean Default: false Allowed values: true or false When the code type is Datamatrix and GS1Flag is set to true the Caption data is scanned for the presence of GS1 FNC1 characters and Application Identifiers (AIs). If the first data character is not an FNC1 character, one is inserted!

PostFlag Type: bool Default: false Allowed values: true or false

38  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

Applies to Datamatrix code type only. When set true the symbol is created as a PostMatrix symbol, with two additional vertical bars.

StartMode Type: integer Default: 0 Allowed values: See appendix for allowed mode setting for specific barcode types.

SecurityLevel Type: integer Default: 0 Allowed values: See appendix for allowed security level setting for specific barcode types and modes.

.NET Information properties Note that the barcode symbol is determined only when this Barcode() method is called, so the information properties are not available until this method has been called.

Error Type: integer Returns a value representing the error code if a valid barcode image cannot be created. Otherwise returns 0. Read only. Do not set this property. The error codes and corresponding Status property values are shown below:

Status Type: string Returns a string interpreting the value of the Error property. The error codes and corresponding Status property values are shown below: Error

Status

0 1 2 3 9

OK Illegal character in data Wrong data length Error in barcode data Other error

Read only. Do not set this property.

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  39

Pattern Type: String Returns: symbol.

A string containing a pattern of digit characters which represent the bars and spaces in the barcode

Read only. Do not set this property. The pattern string returned for a PDF417 symbol consists of the sequence of digits used to represent the thickness of bars and spaces alternately in the symbol (starting with the first bar), arranged by row. Bar height is at the user’s choice. Each row is separated by a newline (\n or CHR(10)) characters. The pattern string returned for an Aztec, Datamatrix or QR Code symbol consists of the sequence of characters used to create the symbol, arranged by row, with a ‘1’ for a black square and a ‘0’ for a white square. Each row is separated by a newline (\n or CHR(10)) characters.

.NET Component Methods Barcode() Return Type:

string

This method causes a barcode to be created as a string of characters that, when displayed in the AZTx font will form the barcode symbol. Note that the barcode symbol is determined only when this method is called, so the information properties are not set until this method has been called.

Properties() Return Type:

BOOL

Displays the Barcode properties dialog for the component.

40  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

Returns TRUE if the user exits the dialog by pushing the OK button and sets all component properties to those specified in the dialog. Returns FALSE if the user exits the dialog by pushing the Cancel button.

Error Codes All components can provide an error code for occasions when a symbol cannot be created. 1 2 3 4 5 6 7 8 9

Invalid data length Invalid code type Invalid parameters Illegal character in data Invalid embedded code Line width too small Font error Error creating barcode Error creating barcode

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  41

Appendix Allowed parameter values CodeType CodeType

Symbol type

0

Aztec

1

Datamatrix

2

PDF417

3

Micro PDF417

4

Truncated PDF417

5

QR Code

6

Micro QR Code

Aztec Symbols CodeType 0

ModeType ModeType parameter

Barcode mode

0

Normal

1

Compact

2

Full range

3

Rune

For most applications a mode of 0 is recommended, along with a level of 0 which provides the default value of 23% + 3 codewords.

Security Level Allowed values for Aztec codes depend on the mode, and are 0-99 for Normal mode, 1-4 for Compact mode, and 1-32 for Full range mode (the value is ignored for Runes). Note that for Compact and Full range the security level is actually the required number of Aztec layers in the symbol.

42  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

Datamatrix Codetype 1 DataMatrix is a two-dimensional matrix symbology that is made up of square modules arranged within a finder pattern. DataMatrix symbols may be square or rectangular.

DataMatrix symbols may include a user-select amount of error-correction, set by the security parameter. For Square symbols the value may range from 0 – 24. For Rectangular symbols the value may range from 0 - 6. DataMatrix symbols can encode the entire ASCII character set and uses multiple encoding modes, which are, in order of efficiency: Double digits – maximum capacity 3100 digits Alphanumeric text – maximum capacity 2300 characters* Byte values – maximum capacity 1550 bytes *Note that capital letters, punctuation and new lines/paragraphs reduce this value. dLSoft 2D barcode products support only ECC200 symbols – the older ECC140 and below are not supported. Also at this time ECI and Appended symbols are not supported. The DeutschePost variant of Datamatrix may be created generally by checking the DeutschePost option in dialogs, or setting the DL_DEUTSCHEPOST flag (bit 9, or value 512) in the flags parameter of the function calls.

ModeType ModeType value

Barcode mode

0

Automatic – Square

1

Automatic – Rectangular

2

ASCII encoding – Square

3

ASCII encoding – Rectangular

4

C40 encoding – Square

5

C40 encoding – Rectangular

6

Text encoding – Square

7

Text encoding – Rectangular

8

X12 encoding – Square

9

X12 encoding – Rectangular

10

EDIFACT encoding – Square

11

EDIFACT encoding – Rectangular

12

Base 256 encoding – Square

13

Base 256 encoding – Rectangular

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  43

PostMatrix The Deutsche Post PostMatrix code is a Datamatrix symbol preceeded by two vertical lines before the vertical alignment edge of the Datamatrix symbol.

Most of the components in this product can generate PostMatrix codes, generally by checking the Postmatrix option in dialogs, or setting the DL_POSTMATRIX flag (bit 6, or value 64) in the flags parameter of the function calls.

GS1 encoding GS1 encoding may be enforced by setting DL_DM_GS1 flag (bit 1, or value 2) in the flags parameters of the function calls.

PDF417 CodeType 2; Truncated PDF417 is CodeType 4. PDF417 (Portable Data File 417) is a stacked barcode symbology capable of encoding over a kilobyte of data in a symbol.

PDF417 may include extensive error-correction enabling data to be recovered from a symbol that has been damaged or corrupted. There are 900 different patterns (codewords) which may be incorporated into a PDF417 symbol, and several modes available for encoding. Truncated PDF417 symbols use the same structure. Modes and levels as PDF417, but have the righthand codeword and stop bars omitted from the symbol. Truncated PDF417 symbols have the advantage of being smaller than full PDF417, but the disadvantage of being less able to tolerate damage without becoming unreadable.

Encoding Modes EXC (Extended Alphanumeric Compaction mode) - allows encoding of all printable ASCII characters into about 2 characters per codeword. Within the EXC mode there are several submodes: Alphanumeric, Lower case, Mixed, Punctuation. Binary/ASCII Plus mode - allows encoding of 256 international characters including the full ASCII set plus any 8-bit value in the range 0 - 255. This mode allows encoding approximately 1.2 bytes per codeword and so is considerable less efficient than EXC mode.

44  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

Numeric mode - allows encoding of a string of digits with a density of approximately 2.95 digits per codeword. Recommended where more than 13 digits are to be encoded. Numeric mode symbols may not contain non-numeric characters. The maximum capacity of PDF417 symbols is approximately as follows: Numeric mode – maximum capacity 2700 digits* Alphanumeric text – maximum capacity 1800 characters* Byte values – maximum capacity 1100 bytes *Note that capital letters, punctuation, mode shifts and new lines/paragraphs reduce these value. ModeType value

Initial mode

0

Exc Alpha

1

Exc Lower case

2

Exc Mixed

3

Exc Punctuation

4

Binary/ASCII

5

Numeric

Unless Binary or Numeric modes are specifically required, it is recommended that the ModeType value 0 is used. The component will automatically adjust the mode type to accommodate the data.

Security level One of PDF417’s most valuable features is its ability to allow correction of errors. This ability is provided by the inclusion of additional codewords within the symbol, so that the data codewords may be reconstructed even if some are defaced or misread. The number of damaged codewords (Nmax) which may be recovered depends on the security level (which in turn determines the number of additional characters included in the symbol) Security level

Nmax

0

0

1

2

2

6

3

14

4

30

5

62

6

126

7

154

8

510

Codeword Columns The Columns parameter allows the user to specify the number of codeword columns displayed in a PDF417 symbol (NOT including the start and stop groups of bars). The value may be 3 – 12.

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  45

Micro PDF417 MicroPDF417 is a multi-row symbology based on PDF417 designed for applications requiring a greater area efficiency but lower data capacity than PDF417. A specific and limited set of symbol sizes is available, each size including a fixed level of error correction. MicroPDF417 provides for three encoding modes: Text, Byte and Numeric compaction. Text is for general text, Numeric for encoding data consisting only of digits, and Byte to allow for the first 127 ASCII characters but with a reduced level of efficiency. Four symbol widths are permitted, each specifying the number of data columns (1 – 4). Within each symbol width a variable number of rows provide for a maximum data capacity of: Text compaction mode: 250 characters (2 data characters per codeword) Byte compaction mode: 150 characters (1.2 data characters per codeword) Numeric compaction mode: 366 characters (2.93 data characters per codeword) ModeType value

mode

0

Text compaction

1

Byte compaction

2

Numeric compaction

The SecurityLevel parameter for MicroPDF barcodes set the number of data columns within the barcode, which may be 1 – 4.

Macro sequences For MicroPDF417, if data string starts with “[)>” data is treated as a macro and the following character patterns translated into low ASCII codes:

String

converted to

{ET}

ASCII 4

{FS}

ASCII 28

{GS}

ASCII 29

{RS}

ASCII 30

These translations are useful because Micro PDF417 supports the industry macro sequences [)>{RS}05{GS} and [)>{RS}06{GS} (where {RS} represents ASCII 30 and {GS} is ASCII 29).

QR Code barcodes QR Code is a matrix symbology consisting of a square array of modules with a finder pattern located at three corners. A wide range of symbol sizes is supported along with four levels of error correction, and the symbology is noted for its high data density.

46  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

The dLSoft libraries support QR Code Version 2 in Numeric, Alphanumeric and Byte modes. (Kanji mode is not supported by all components). The maximum data capacity of the symbols (at Level 0 error correction) are: Numeric data 7089 digits Alphanumeric data 4296 characters Byte data 2953 bytes Note that Alphanumeric includes digits and uppercase letters, the space and the $ % * + - . / : characters only. The Reed-Solomon error correction allows the following recovery of damaged codewords: Level 0: 7% Level 1: 15% Level 2: 25% Level 3: 30%

ModeType ModeType value

mode

0

Automatic

1

Alphanumeric

2

Byte

3

Kanji*

*Note that Automatic mode does NOT detect Kanji characters. To encode Kanji mode must be 3.

Security Level The following levels are supported

Security level

QR name

0

L

1

M

2

Q

3

H

dLSoft Universal Barcode Font Kit

Universal Barcode Fonts  47

Flags If bit 1 of the Flags parameters is set (ie Flags=2) then GS1 encoding is used.

Micro QR Code

Micro QR Code is a very small QR Code that fits applications that require a smaller space and use smaller amounts of data, such as ID of printed circuit boards and electronics parts, etc. The efficiency of data encoding has been increased with the use of only one position detection pattern. The capacity of Micro QR Code symbols at the lowest error correction level is: Numeric data 35 digits Alphanumeric data 21 characters Byte data 15 bytes

ModeType ModeType value

mode

0

Automatic

1

Alphanumeric

2

Byte

Security Level The following levels are supported Security level

QR name

0

L

1

M

2

Q

48  Universal Barcode Fonts

dLSoft Universal Barcode Font Kit

Index

. .NET Component Methods 40 .NET Component Properties 37 .NET Information properties 39

BarCdf () 8 BarCdi() 12 BarCdt() 13 BarCdv() 11 BarCdvc() 11 BarCdvs() 11 BarCdvw() 12 BarCdw () 9 Barcode() 40 BarCopy() 16, 33 BarRatio 21 BarSave() 33 BarSave(filename) 16 BarsOut2D() 26 BarsOutUn() 8 ByteNumber 37

C

1D Barcode types supported 5 1D Barcode Types Table 5 1D components 2 1D Function calls 8

Caption 21, 37 CodeType 21, 38, 42 CodeTypeValue 21, 38 Codeword Columns 45 Colors Property page 15 Control methods 33 control properties 32

2

D

2D components 2 2D Function calls 26

Data Property page 32 Datamatrix 43 DeutschePost 38 Direct creation functions 8 Displaying a barcode on a form 36

1

A Access 14, 31 Adding a .NET component to a project. 35 Adding a .NET Component to the ToolBox 35 Adding a uninet.NET component to a project. 19 Adding uninet.NET to the ToolBox 19 Allowed parameter values 42 Appendix 42 AutoCheckDigit 20 Aztec Symbols 42

B Bar2DUc () 27 Bar2DUf () 26 Bar2DUf2 () 26 Bar2DUin 29 Bar2DUrd 29 Bar2DUw () 27 BarAsk() 10 BarAsk2DU 27 BarAsk2DUEx 28 BarCdc () 9

dLSoft Universal Barcode Font Kit

E Encoding Modes 44 EnumCode2D() 29 EnumMode2D() 30 Error 22, 39 Error codes 13, 41 ErrorMess() 13 ErrorMess2D() 30 Extra1 21 Extra2 22

F Flag 38 flags 48 Font 22 Font Property page 15, 32 Functions for setting and using default characteristics 10

Index  49

G General Property page 15, 32 getBarcode() 23 getBarcode2() 23 GetError() 17, 34 GetMaxLevel() 34 GetModeName() 33 GS1 encoding 44 GS1Flag 38 GS1style 22

I Information functions 12 Information properties 22 Installation 1 Installing additional fonts 2 Introduction 1

Setting and retrieving property values programmatically 20, 35 Setting properties through the Barcode properties dialog box 36 ShowProps() 17, 34 StartMode 39 Status 22, 39 String2 23

T The 1D Fonts & Tools 4 The 2D Barcode Fonts & Tools 25 The Control's Methods 16 The Control's Properties 15 The DLUNIF DLL 7 The U2DDFU DLL 25 The U2Docx Control 31 The Uniocx control 14 TypeName(iCodeType) 16

L Licensing the .NET component 20 Licensing the component 37

M Macro sequences 46 MaxLevel2D() 30 Methods 23 Micro QR Code 48 ModeType 42, 43, 47, 48

O Office documents 14, 31

P Pattern 23, 40 PDF417 44 Placing the control on a form 14, 31 PostFlag 38 PostMatrix 44 Printing a barcode 36 Properties 20 Properties() 40 Property pages 15, 32

U U2Dnet .NET component 35 uninet .NET component 18 Uninet barcode types table 18 Universal Barcode Fonts 1 Using the .NET Component in Visual Studio 35 Using uninet.NET Visual Studio.NET 19 Using with CreateObject 3

V Visual Basic 14, 31

W Windows 7 3 Windows 8 3 Windows XP/2003/Vista 3

Q QR Code barcodes 46

S Security Level 42, 45, 47, 48 SecurityLevel 39

50  Index

dLSoft Universal Barcode Font Kit