Professional Documents
Culture Documents
Universal Barcode Font Kit
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
Index 49
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
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.
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.
UNA 50:1
UNB 33:1
UNC 25:1
UND 20:1
UNE 15:1
UNF 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, EAN-
8, 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:
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.
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 EAN-
13, 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.
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
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
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).
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
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
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:
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.
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.
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.
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.
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)
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.
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:
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();
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.
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.
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
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
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
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.
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
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
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.
For example:
Printing a barcode
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).
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.
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
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.
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 OK
1 Illegal character in data
2 Wrong data length
3 Error in barcode data
9 Other error
Read only. Do not set this property.
Properties()
Return Type: BOOL
Displays the Barcode properties dialog for the component.
Error Codes
All components can provide an error code for occasions when a symbol cannot be created.
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.
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
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.
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)
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.
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.
ModeType
*Note that Automatic mode does NOT detect Kanji characters. To encode Kanji mode must be 3.
Security Level
The following levels are supported
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
Security Level
The following levels are supported
Index BarCdvs() 11
BarCdvw() 12
BarCdw () 9
Barcode() 40
BarCopy() 16, 33
BarRatio 21
BarSave() 33
BarSave(filename) 16
BarsOut2D() 26
BarsOutUn() 8
. ByteNumber 37
.NET Component Methods 40
.NET Component Properties 37 C
.NET Information properties 39
Caption 21, 37
CodeType 21, 38, 42
1 CodeTypeValue 21, 38
1D Barcode types supported 5 Codeword Columns 45
1D Barcode Types Table 5 Colors Property page 15
1D components 2 Control methods 33
1D Function calls 8 control properties 32
2 D
2D components 2 Data Property page 32
2D Function calls 26 Datamatrix 43
DeutschePost 38
Direct creation functions 8
A Displaying a barcode on a form 36
Access 14, 31
Adding a .NET component to a project. 35 E
Adding a .NET Component to the ToolBox 35
Adding a uninet.NET component to a project. 19 Encoding Modes 44
Adding uninet.NET to the ToolBox 19 EnumCode2D() 29
Allowed parameter values 42 EnumMode2D() 30
Appendix 42 Error 22, 39
AutoCheckDigit 20 Error codes 13, 41
Aztec Symbols 42 ErrorMess() 13
ErrorMess2D() 30
Extra1 21
B Extra2 22
Bar2DUc () 27
Bar2DUf () 26 F
Bar2DUf2 () 26
Bar2DUin 29 Flag 38
Bar2DUrd 29 flags 48
Bar2DUw () 27 Font 22
BarAsk() 10 Font Property page 15, 32
BarAsk2DU 27 Functions for setting and using default characteristics
BarAsk2DUEx 28 10
BarCdc () 9
Q
QR Code barcodes 46
S
Security Level 42, 45, 47, 48
SecurityLevel 39