TBarCode .NET 11 Developer Manual
TBarCode .NET 11 Developer Manual
NET
Barcode Library for .NET
V ers io n 1 1
6 M arc h 20 1 5
T EC- IT Da te n v er arb e it un g G m bH
Ha ns -W agner - Str . 6
A- 44 0 0 S te yr , A us t ri a
t + + 43 ( 0)7 2 52 72 7 20
f + + 43 ( 0)7 2 52 72 7 20 77
of f ic e @ tec - i t.c om
ww w. tec - i t.c om
T Bar Cod e f or . N ET D ev e lop er M anu al
1 Content
1 Content 2
2 Disclaimer 3
3 Introduction 4
3.1 What is TBarCode SDK? 4
3.2 What is TBarCode .NET? 4
3.3 Scope of this Document 4
3.4 Restrictions of the Demo Version 4
4 Installation 5
4.1 Requirements 5
4.1.1 Operating Systems 5
4.1.2 .NET Version / IDEs 5
4.2 Download and Setup 5
4.2.1 Installation Path 6
5 Barcode Form Control 7
5.1 Introduction 7
5.2 Create or Open a Project 7
5.3 Reference the Barcode Controls 8
5.4 Add Barcode to a Form 9
5.5 Adjust Properties 9
5.6 Finally – Run the application 10
5.7 API Reference 10
6 Barcode Web-Control 12
6.1 Introduction 12
6.2 Create/Open a Website 12
6.3 Reference the Barcode Controls 12
6.4 Add Barcode to Form 14
6.5 Adjust Properties 15
6.6 Finally – Preview Web Page in Browser 15
6.7 API Reference 16
7 Barcode Class 17
7.1 Introduction 17
7.2 Create a new Project 17
7.3 Add Reference to TBarCode 18
7.4 Render Barcodes 19
7.4.1 Add Barcode Object 19
7.4.2 Write custom OnPaint-Method 19
7.5 Finally – Run the application 20
7.6 Build Errors 20
7.6.1 Visual Studio 2010 with .NET 4 Client Profile 20
7.7 API Reference 22
8 How to license TBarCode 23
8.1 License Types 23
8.2 License TBarCode 23
9 Redistributing TBarCode 24
9.1 Dependencies 24
9.2 Redistribution 24
9.2.1 Visual C++ 2010 SP1 Runtime 24
9.2.2 Using the MSI installer from TEC-IT 25
9.2.3 Why Platform Specific Versions? 25
10 Contact and Support Information 26
Appendix A : Related Downloads 27
A.1 Barcode Reference 27
A.2 Samples 27
A.3 User Manual 27
A.4 FAQ – Frequently Asked Questions 27
Page 2 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
2 Disclaimer
The actual version of this product (document) is available as is. TEC-IT declines all warranties
which go beyond applicable rights. The licensee (or reader) bears all risks that might take place
during the use of the system (the documentation). TEC-IT and its contractual partners cannot be
penalized for direct and indirect damages or losses (this includes non-restrictive, damages through
loss of revenues, constriction in the exercise of business, loss of business information or any kind of
commercial loss), which is caused by use or inability to use the product (documentation), although
the possibility of such damage was pointed out by TEC-IT.
We reserve all rights to this document and the information contained therein. Reproduction,
use or disclosure to third parties without express authority is strictly forbidden.
Für dieses Dokument und den darin dargestellten Gegenstand behalten wir uns alle Rechte
vor. Vervielfältigung, Bekanntgabe an Dritte oder Verwendung außerhalb des vereinbarten
Zweckes sind nicht gestattet.
© 1998-2015
TEC-IT Datenverarbeitung GmbH
Hans-Wagner-Str. 6
A-4400 Austria
t.: +43 (0)7252 72720
f.: +43 (0)7252 72720 77
http://www.tec-it.com
Page 3 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
3 Introduction
TBarCode SDK is available in several versions for different operating systems, applications and
programming environments.
TBarCode .NET A barcode .NET library for software developers. It includes a bar code
class and barcode controls for Windows Forms and ASP.NET 2.0.
TBarCode OCX A Microsoft® ActiveX® compliant barcode control. It can be used with
Microsoft® Office applications and for software development.
TBarCode Library A bar code DLL for Windows platforms for software developers.
(A DLL for Windows CE/Windows Mobile is available on request. Please
contact us with your platform details.)
TBarCode .NET is .NET library for barcode generation. This library contains
This document explains how you can add barcodes to your .NET projects with TBarCode .NET.
The complete API (application programming interface) is described in the TBarCode .NET
Developer Reference.
In the demo version the barcodes will be drawn with a demo-hint. That means that the word “Demo”
or the phrase “www.tec-it.com” is drawn partially over the barcode. The demo-hint does not influ-
ence the readability of the barcode in a negative way.
► In special cases (e.g. very small or high-resolution barcodes) you may want to test the pro-
duct without demo restrictions. Please contact sales@tec-it.com for a temporary license key.
► For enabling the full-featured version (without the demo hints) you can obtain a license key
from TEC-IT (http://www.tec-it.com/order/).
► For more information on licensing TBarCode, please refer to chapter 8.
Page 4 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
4 Installation
4.1 Requirements
4.1.1 Operating Systems
TBarCode.NET requires .NET Framework 2.0 or higher. It can be used with all IDEs supporting
.NET 2.x (like Microsoft Visual Studio 20051 or newer).
► You cannot use .NET 4 Client Profile with TBarCode.NET, because it uses ASP.NET, which
is not included there.
► Please use .NET 4 Full Framework or another version of the .NET framework (e.g. 3.5 or
4.5) instead.
TBarCode .NET
For .NET developers. Developer manual and API reference are included in the setup.
TBarCode OCX
A barcode ActiveX control for Microsoft Office users and for software developers. User
manual and API reference are included in the setup.
TBarCode Library
For software developers. Developer manual and API reference are included in the setup.
1
VS2003 is not supported because it uses .NET 1.1
Page 5 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
Please note that the x64 setup installs also a 32 bit version of the Barcode Library to
C:\Program Files (x64)\Common Files\TEC-IT\TBarCode\11.0
Page 6 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
5.1 Introduction
This chapter explains how to insert a barcode into a .NET Windows Form. TBarCode SDK contains
a Windows Form control called BarcodeControl, which can easily be added to any .NET form.
TBarCode 11 installed.
Visual Studio 2005 or a Visual Studio 2005 Express Edition 2 or newer versions.
Basic knowledge about any .NET language (VB.NET, C#, etc.)
Start Visual Studio and open an existing Windows Forms project or create a new project:
2
The Visual Studio Express Editions are free development environments form Microsoft. Visit
http://msdn.microsoft.com/vstudio/express/default.aspx to find out more.
Page 7 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
To work with the barcode controls, you first need to add them into Visual Studio:
3
Since Visual Studio itself is compiled as a 32 bit application you should reference the x86 version of TBarCode when
adding TBarCode to the Toolbox. This limitation applies to the Windows Forms Control in the Toolbox only.
Page 8 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
Now, simply drag and drop the BarcodeControl from the Toolbox onto your Windows form.
The barcode is now visible on your Windows Form. You can change the appearance (position and
size) in the design view.
Page 9 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
Page 10 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
Page 11 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
6 Barcode Web-Control
6.1 Introduction
This chapter explains how to insert a barcode into an ASP.NET web site. TBarCode SDK contains
a web control called BarcodeControl, which can easily be added to any ASP.NET page.
TBarCode 11 installed.
Visual Studio 2005 or a Visual Studio 2005 Express Edition or newer versions.
Basic knowledge about any .NET language (VB.NET, C#, etc.)
Start Visual Studio and open an existing ASP.NET web project or create a new one:
To work with the barcode controls, you first need to add them into Visual Studio:
Page 12 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
4
Since Visual Studio itself is compiled as a 32 bit application you should reference the x86 version of TBarCode when
adding TBarCode to the Toolbox. This limitation applies to the Web Control in the Toolbox only.
Page 13 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
Page 14 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
The barcode placeholder is now visible on your ASPX page. You can change the appearance
(position and size) in the design view.
Please click Start Debugging to preview the web page in the browser.
Page 15 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
Page 16 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
7 Barcode Class
7.1 Introduction
TBarCode SDK not only provides a Windows Form Control and a Web Control to generate
barcodes. The core functions are implemented in the Barcode class. This class can be used to
generate barcodes in any type of application (e.g. in a Windows Forms application, on web site, in
console applications, etc.).
Here is a brief tutorial on how to render a barcode using the Barcode class.
TBarCode 11 installed.
Visual Studio 2005 or a Visual Studio 2005 Express Edition or newer versions.
Basic knowledge about the C# language.
Page 17 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
In order to use the Barcode class, the project needs to reference the TECIT.TBarCode.dll:
5
Please make sure to reference the correct version according to your platform target (see also 9.2.3).
Page 18 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
3. Now, we can use a Barcode object to render a barcode. Add the following lines of code
(marked as bold):
// C# Sample
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using TECIT.TBarCode;
Page 19 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
namespace WindowsApplication1
{
public partial class Form1 : Form
{
Barcode barcode;
public Form1()
{
InitializeComponent();
SetStyle(ControlStyles.ResizeRedraw, true);
MinimumSize = new Size(100, 100);
// Initialize barcode
barcode = new Barcode();
barcode.BarcodeType = BarcodeType.DataMatrix;
barcode.Data = "Here is some random context for my sample barcode.";
}
In this sample we create a Data Matrix barcode, which is a 2-dimensional barcode variant.
Please click Start Debugging to run the application. The result can be seen in Figure 18.
You may see an error that the TECIT namespace could not be found with the following warning:
The referenced assembly "TECIT.TBarCode, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=1b5f4306b234b83d, processorArchitecture=x86" could not be resolved because
it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework
".NETFramework,Version=v4.0,Profile=Client".
Page 20 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
This is because your project is using the .NET 4.0 client profile which does not include
System.Web. Why is there a dependency on System.Web? The referenced TBarCode assembly file
in your project contains also the Barcode Web Control.
You actually need to reference the full framework to solve this issue. Change your target framework
to .NET framework 4 in the project settings.
Page 21 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
Page 22 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
Please check out http://www.tec-it.com/order for available license types and pricing.
Without a valid license an additional text “Demo” is drawn across the barcode as shown in Figure
21.
As soon as you have acquired a license, you can pass the license data to TBarCode, for example:
barcode.License("John Smith", LicenseType.DeveloperOrWeb, 1, "00000000",
TBarCodeProduct.Barcode1D); // 1D License
Alternatively, you can set the license by using the license-properties of the barcode object. For
example:
barcode.Licensee = "John Smith";
barcode.LicenseType = LicenseType.DeveloperOrWeb;
barcode.LicenseCount = 1;
barcode.LicenseKey = "00000000";
barcode.LicensedProduct = TBarCodeProduct.Barcode1D;
Page 23 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
9 Redistributing TBarCode
This chapter explains what is important when redistributing a custom application that uses the
TBarCode .NET controls.
9.1 Dependencies
A .NET application that uses TBarCode SDK requires the following files:
TECIT.TBarCode.dll
This is a .NET assembly that contains the .NET controls. This file is mandatory.
TBarCode11.dll
This is a native Win32 (x86) library that performs barcode generation. This file is
mandatory for 32-Bit applications (platform x86 or Any CPU on x86 systems).
TBarCode11_x64.dll
This is a native Win64 (x64) library that performs barcode generation. This file is
mandatory for 64-Bit applications (platform x64 or Any CPU on x64 systems).
zlib1.dll
This is a 3rd-party library that performs data compression. This file is optional. It is only
required, when data compression in barcodes is enabled.
These files are located in the folder6 C:\Program Files\Common Files\TEC-IT\TBarCode\11.0 (or in
the folder you have chosen during setup).
Because we rely on native code, also the Visual C++ 2010 SP1 runtime components have to be
installed on the computer. See next section how to distribute them with your application.
The target .NET framework (.NET 2.0, 3.0, 3.5, 4) must be available on the target system.
9.2 Redistribution
When redistributing a custom application the files described above need to be redistributed together
with the application. The DLLs should be located in the same folder as the executable. Other files
than those listed above must not be redistributed.
For web applications, the DLLs should be placed in the bin directory of the web site.
You may also have to deploy the runtime components of Visual C++ 2010 SP1 along with your
application and/or ensure they are installed on the target computer.
You can install these components with the Microsoft Visual C++ 2010 SP1 Redistributable
Package available at
- 32 Bit (x86) version: http://www.microsoft.com/en-us/download/details.aspx?id=8328
- 64 Bit (x64) version: http://www.microsoft.com/en-us/download/details.aspx?id=13523
6
On Windows x64 this path contains the 64 Bit component. For the 32 Bit component see C:\Program Files (x86)\...
Page 24 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
If you use a setup tool and your installer supports merge modules (*.msm files) you can add
the required msm packages to your setup:
- 32 Bit (x86)
- Microsoft_VC100_CRT_x86.msm
- 64 Bit (x64)
- Microsoft_VC100_CRT_x64.msm
As an alternative for distributing the required files along with your application you can install
TBarCode .NET from the TBarCode SDK MSI installer available from our web site.
When using the MSI installer from TEC-IT you also have the option for a silent setup – see FAQ
TBarCode SDK Distribution - How To Create a Silent Setup.
The MSI installer contains also the Visual C++ 2010 SP1 runtime files (but no .NET framework!). It
registers the .NET assemblies in the GAC and extends the PATH environment variable so that all
native DLL dependencies are found.
► At least for web applications the MSI installer may be a convenient option. Make sure to
restart IIS (admin console command “iisreset”) in order to update the DLL search path.
► Please contact TEC-IT Support if you need further assistance.
Why do we use or offer two different TEC-IT.TBarCode.dll files, one with platform x86 and one with
platform x64? Why is there no version with platform “Any CPU”?
TBarCode .NET internally relies on the TBarCode Library, which is a native code DLL - it is loaded
on demand in the background. In order to support both 32 bit and 64 bit platforms we have two
different versions of TBarCode Library (TBarCode11.dll and TBarcode11_x64.dll) and therefore
also two different platform targets for the TEC-IT.TBarCode.dll .NET assembly.
Page 25 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
Address: Hans-Wagnerstr. 6
AT-4400 Steyr
Austria/Europe
Phone: +43 / (0)7252 / 72 72 0
Fax: +43 / (0)7252 / 72 72 0 – 77
Email: office@tec-it.com
Web: http://www.tec-it.com
FAQ: http://www.tec-it.com/support/faq/tbarcode/Default.aspx
All other products mentioned are trademarks or registered trademarks of their respective companies. If any trademark on our web site or in this
document is not marked as trademark (or registered trademark), we ask you to send us a short message (office@tec-it.com).
Page 26 of 27
T Bar Cod e f or . N ET D ev e lop er M anu al
The Barcode Reference is available as separate document on the TEC-IT web-site http://www.tec-
it.com ► Support ► Knowledge Base
http://www.tec-it.com/download/PDF/Barcode_Reference_EN.pdf.
A.2 Samples
TEC-IT provides a number of sample applications which allow customers to start with the develop-
ment of their own applications and/or documents as fast as possible.
Sample applications are included in the TBarCode11 setup (Start Menu: TEC-IT TBarCode 11 ►
Examples) or can be downloaded from the TEC-IT web site http://www.tec-it.com (download area).
► Make sure TBarCode SDK was installed before trying to run any sample application!
User Manual
A description on how to use TBarCode OCX (the Microsoft ActiveX compliant Barcode
Control) in applications which are part of Microsoft Office. Microsoft Word, Microsoft Excel,
Microsoft Access and Microsoft InfoPath are discussed
API Reference
A detailed description of the TBarCode interface (methods, properties, enumerations and
events).
These documents are included in the setup (Start Menu: TEC-IT TBarCode 11 ► Manuals).
Page 27 of 27