Barcode DLL for .NET CF User Manual & Tutorial
IDAutomation's Barcode DLL for .NET Compact Framework allows integration
of dynamic barcodes into mobile apps
using the Microsoft Compact Framework. Several linear and 2D
barcode symbologies are supported including UPC, EAN, Code 128, Code 39, PDF417 and Data
Setup & Tutorial
This documentation refers to IDAutomation's Linear .NET Compact Framework
DLL. Please make the following substitutions when using the PDF417 or Data
IDAutomaton.design.LinearBarcodeControl.dll = IDAutomation.design.PDF417BarcodeControl.dll
IDAutomationCFLinear.dll = IDAutomationCFPDF417.dll
IDAutomaton.design.LinearBarcodeControl.dll = IDAutomation.design.DataMatrixBarcodeControl.dll
IDAutomationCFLinear.dll = IDAutomationCFDataMatrix.dll
There are two components necessary when creating an application for the
.NET Compact Framework (CF). A design time component (IDAutomation.design.LinearBarcodeControl.dll),
which can use all of the functionality of the full .NET Framework, and a
run-time component (IDAutomationCFLinear.dll), which uses only functionality
allowed by the Compact Framework.
The following steps outline the process for setting up the environment to
use the Compact Framework control:
- Copy the runtime and designer versions of the controls
to the project directory. Do not copy the files to the BIN directory,
they will be automatically copied there when deployed.
- Open the Smart Device Application project in Visual Studio.NET.
If a current project does not exist, open the image generator sample
project included in the downloaded zip file.
- If the Toolbox is not visible in the application, open the form
the control is to be placed on and select View | Toolbox from
the main Visual Studio.NET menu.
- Find the section in the Toolbox entitled Device Controls.
Right click the Toolbox and choose Add/Remove Items. A
screen similar to the figure below will appear:
- Click the "Browse" button and select the designer version
of the control, IDAutomation.design.LinearBarcodeControl.dll,
click "Open", then click "OK" on the Customize Toolbox dialog.
The control should appear in the Toolbox, do not place the control
on the form yet.
- Before dragging the control on a form, a reference must be
set to the run-time version of the control, so that it is copied to
the target device or emulator. This is done from Solution Explorer.
If Solution Explorer is not visible, click View | Solution Explorer.
Right click "References" in Solution Explorer. Click "Add Reference".
- On the Add Reference dialog click "Browse", select the runtime
version of the control IDAutomationCFLinear.dll and click "Open".
Click "OK" on the Add Reference dialog.
- The control should now available to the Compact Framework Application.
Printing from the control:
The .NET Compact Framework does not include native support for printing
from a Windows Mobile device. In order to print from one of these devices,
clients will need to use the Windows CE API, or a third party component
specifically designed for printing from a Windows Mobile device such as
the HP Windows
Mobile Printing products.
IDAutomation has created a generic sample application available in this
product that illustrates how to print a barcode image and text from a Windows
Mobile device using the Windows CE API.
the use of this API in this sample application is currently problematic
on most devices. Therefore, it is currently only an example of how the printing
should work. At this time IDAutomation recommends using a 3rd party printing
component to perform the printing functionality such as the
Mobile Printing products.
Before opening the sample project, please read the following notes regarding
the application and the Compact Framework:
- The Compact Framework includes no native support for printing. The
sample application uses P/Invoke and the Windows CE API to do the printing.
- There are other ways to print from a Pocket PC device, such as printing
directly to a printer through an I/O channel. Unfortunately, this method
only supports text printing. Or, using a third party vendor control
for printing. Examples of such components include HP's direct printing
or PrinterCE's control for printing.
- The print dialog box that appears in the emulator will be different
based on the individual configurations of each machine. However, as
long as there are print drivers loaded on the device, everything should
- The example project is based on IDAutomation's Linear CF Control.
Other controls can be easily substituted for the Linear CF Control.
- To simplify the code, the only property being set of the control
from the application is DataToEncode. That value is printed as text
and the barcode is then printed as a graphic.
- The Compact Framework has limited properties for bitmap objects.
Instead of saving the bitmap to a memory stream, the bitmap must be
copied pixel by pixel into a byte array so that it can be sent to the
Windows CE API.
- The main routine for writing the image to the printer is GdeGraphics.StretchDIBits
Placing barcodes in a PictureBox:
- This is a simple example of how to send the barcode bitmap to a
pictureBox1.Image = barcode1.BMPPicture;
Dynamically placing the control on
- This is how the barcode can be created on the form with code.
IDAutomation.CF.PDF417Barcode.PDF417Barcode pdF417Barcode2 = new
properties of the component
After inserting the control in the application, properties of the control
may be changed. To do this, change the properties with program code or right-click
on the control and choose Properties if it is installed on a form.
Sizing the control:
The control cannot be sized manually because it must meet specific requirements,
such as a precise X dimension (narrow bar width) and barcode height specified
in the properties of the control. To increase the width, increase the XDimensionCM
or XDimensionMILS property. To increase the height, increase the BarHeightCM
Parameters and methods:
NOTE: Many of the barcode sizing parameters are calculated in
cm (centimeters). Some barcode measurements are determined in "mils", which
are 1/1000 of an inch. Use the following rules for assistance with conversions:
convert mils to cm, multiply mils value by .00254. For example, 12 mils *
.00254 = .03 cm.
To convert cm to mils, divide the cm value by 2.54. For example, .03
cm / 2.54 = 11.8 mils.
To convert inches to cm, multiply the value in inches by 2.54.
- Read the
PDF417 FAQ for
information about this symbology.
These properties are available only in the 2D version for idautomation.cfpdf417.dll.
- ApplyTilde - If set to "true", use the format ~ddd to specify
the ASCII code of the character to be encoded. Default is "true". Commonly
used ASCII codes are ~009 for a tab and ~013 which is a return function.
- PDFColumns - Controls the width and height by increasing
the number of data columns in the PDF-417 barcode. The default is 0
and the maximum is 30. When this is left at 0, the control will automatically
adjust this setting.
- PDFErrorCorrectionLevel - The Reed Solomon error correction
level placed in the symbol. More error correction creates a larger symbol
that can withstand more damage. Default = 0 for automatic selection.
- PDFMode - The default, (binary mode) encodes bytes of data
and text mode encodes all characters on the US keyboard plus returns
and tabs. If the user is encoding only text, text mode can usually reduce
the symbol size.
- PDFRows - The number of minimum rows. If this setting is
left at 0 the control will automatically adjust this setting. IDAutomation
recommends leaving this set to 0 because the number of rows should be
- XtoYRatio - The X multiple height of individual cells; default=3.
Data Matrix Properties:
- Read the
Data Matrix FAQ
for information about this symbology.
These properties are available only in the 2D version for idautomation.cfdatamatrix.dll.
- EncodingMode - The encoding mode that compresses information
in the symbol; valid values are, E_ASCII, E_C40, E_TEXT or E_BASE256
- ASCII: It is used to encode data that mainly contains
ASCII characters (0-127). It encodes one alphanumeric or two numeric
characters per byte.
- C40: It is used to encode data that mainly contains numeric
and upper case characters. C40 encodes three alphanumeric data characters
into two bytes.
- TEXT: It is used to encode data that mainly contains
numeric and lowercase characters. TEXT encodes three alphanumeric
data characters into two bytes.
- BASE256: It is used to encode bytes of data and 8 bit
- More information about the modes is
- PreferredFormat (DM_FORMAT): Sets the preferred format represented
by a number; valid values are from 0 (10X10) to 23 (144X144) and from
24 (8X18) to 29 (16X48); This will be automatically determined if the
size of the symbol chosen is too small. More about this is documented
- ProcessTilde - If true ("Y") the tilde (~) will be processed.
For example, use ~d032 for a space character, ~d009 for
a tab and ~d013 to encode a return.
- ~dNNN: Represents the ASCII character encoded by the
3 digits NNN. For example, ~d065 represents the character
- ~1: Represents the character FNC1. When FNC1 appears
in the first position (or in the fifth position of the first symbol
of a Structured Append), it will indicate that the data conforms
to the UCC/EAN Application Identifier standard format.
- More about the tilde formatting is documented
Free product support may be obtained by reviewing the knowledgebase articles
that are documented below and by searching the resolved
public forum threads.
email and forum support is provided up to 30 days after purchase.
phone, email and forum support may be obtained if the
and Upgrade Subscription is active.
NOTE: At this time IDAutomation cannot troubleshoot printing problems,
these should be directed to the appropriate vendor that makes the mobile
printing component or contact Microsoft for support if the Windows Mobile
API is being used to print.
Back to Top