86
Nasosoft Barcode for .NET

Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

  • Upload
    others

  • View
    14

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

Nasosoft Barcode for .NET

Page 2: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com

i

Table of Contents

Overview of Nasosoft Barcode for .NET 1

Nasosoft Barcode for .NET Features ....................................................................................... 1 Install Nasosoft Barcode for .NET ........................................................................................... 4

System Requirements ........................................................................................................ 4 Install and Uninstall Nasosoft Barcode for .NET ........................................................... 5 Deploy Nasosoft Barcode for .NET ................................................................................... 5

Getting Started with Nasosoft Barcode for .NET 6

Download and Evaluate Nasosoft Barcode for .NET ............................................................ 6 Build your First App with Nasosoft Barcode for .NET .......................................................... 7 Explore and Study Code Samples ........................................................................................... 8 How to Get Answers and Technical Support ......................................................................... 8

Ask Your Questions on Forum .......................................................................................... 8 Get FREE Technical Email Support .................................................................................. 8 Request Demo or Code Samples for FREE ..................................................................... 9

Request 30 Days FREE Trial License ...................................................................................... 9 Barcode Object Model 10

BarcodeObject Class ................................................................................................................ 11 BarcodeStyle Class ................................................................................................................... 13 BarcodeWriter Class ................................................................................................................. 15 BarcodeImage Class................................................................................................................. 15 BarcodeReader Class ............................................................................................................... 15

Create Barcode Images 16

Working with BarcodeImage Class ....................................................................................... 16 Save a Barcode bitmap to Specified Path .................................................................... 16 Save a Barcode bitmap to Specified Stream ............................................................... 17 Save a Barcode image to Specified Image Format .................................................... 18

Working with BarcodeStyle Class .......................................................................................... 19 Change TopLable Style using BarcodeStyle.TopLabel ............................................... 19 Change Barcode Image Size using BarcodeStyle.ImageWidth ............................... 20 Change Barcode Color using ForeColor and BackgroundColor ................................ 21 Rotate a Barcode Image .................................................................................................. 22

Working with BarcodeWriter Class ........................................................................................ 23 Draw a barcode to the specified Graphics instance ................................................... 23

Read Barcode Images 24

Working with BarcodeReader Classes .................................................................................. 24 Read a barcode image with Specified Path.................................................................. 24 Read a barcode image with Specified Stream ............................................................ 25 Read a barcode image with Specified Bitmap object ................................................ 25

Barcodes in ASP.NET Applications 26

Working with BarcodeWebControl Class .............................................................................. 26 Barcodes in Windows Form Applications 33

Page 3: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com

i

Working with BarcodeWinControl Classes ........................................................................... 33 Barcodes in SQL Server Reporting Services 48

Add Barcode to Your Report ................................................................................................... 48 Drag and Drop Barcode to Report ................................................................................. 48 Working with Barcode Designer ..................................................................................... 52 Create Your First Barcode Report .................................................................................. 54

Configure Barcode for Reporting Services .......................................................................... 67 Configure with Barcode Configuration Tool ................................................................. 67 Manually Configure Visual Studio .................................................................................. 69 Manually Configure SQL Server 2008 Reporting Services ....................................... 70

Code128 Barcode 72

Code128 Overview ................................................................................................................... 72 Code128 Code Sets .................................................................................................................. 72 How to Create Code 128 Barcode through .NET Windows Form Control in C# or VB.NET? ...................................................................................................................................... 72 How to Create Code 128 Barcode Image in .NET class? .................................................. 73 How to Save Code 128 Barcode Image using .NET Barcode Generator Windows Control? ...................................................................................................................................... 73 Code128 Barcode Settings ..................................................................................................... 73

Code39 Barcode 74

Code39 Overview ...................................................................................................................... 74 Code39 Standard and Code39 Extended ............................................................................. 74 How to Create Code 39 Barcode through .NET Windows Form Control in C# or VB.NET? ...................................................................................................................................................... 74 How to Create Code 39 Barcode Image in .NET class? .................................................... 75 How to Save Code 39 Barcode Image using .NET Barcode Generator Windows Control? ...................................................................................................................................................... 75 Code39 Barcode Settings ........................................................................................................ 75 Code39 Barcode Style Settings ............................................................................................. 76

Code93 Barcode 76

Code93 Overview ...................................................................................................................... 76 Code93 Standard and Code93 Extended ............................................................................. 76 How to Create Code 93 Barcode through .NET Windows Form Control in C# or VB.NET? ...................................................................................................................................................... 76 How to Create Code 93 Barcode Image in .NET class? .................................................... 77 How to Save Code 93 Barcode Image using .NET Barcode Generator Windows Control? ...................................................................................................................................................... 77 Code93 Barcode Settings ........................................................................................................ 77 Code39 Barcode Style Settings ............................................................................................. 78

EAN13 Barcode 78

EAN13 Overview ....................................................................................................................... 78 EAN13 Barcode Structure ....................................................................................................... 78 How to Create EAN13 Barcode through .NET Windows Form Control in C# or VB.NET? ...................................................................................................................................................... 79 How to Create EAN13 Barcode Image in .NET class? ....................................................... 79

Page 4: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com

i

How to Save EAN13 Barcode Image using .NET Barcode Generator Windows Control? ...................................................................................................................................................... 80 EAN13 Barcode Settings ......................................................................................................... 80

FAQ 81

Resources 82

Page 5: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 1

Overview of Nasosoft Barcode for .NET

Welcome to Nasosoft Barcode® for .NET.

Nasosoft Barcode for .NET is a suite of powerful barcode components that gives you the

ability to create and read different type of barcode images with Microsoft .NET

technology.

Nasosoft Barcode for .NET provides a set of barcode components, supporting Windows

Form application, ASP.NET application, Windows Foundation Framework (WPF)

application, SQL Server Reporting Service, Windows Phone and etc.

Nasosoft Barcode for .NET supports most of the popular industry barcode standards,

including 1D, 2D and Post barcodes.

Nasosoft Barcode for .NET helps .NET programmers to develop professional barcode

creating and recognizing applications more quickly than ever before.

This document provides a programming guide of Nasosoft Barcode for .NET, with an

emphasis on new and improved features.

Nasosoft Barcode for .NET Features

Platforms

Feature Description

.NET Framework v2.0 Yes, Nasosoft Barcode for .NET supports .NET Framework 2.0.

.NET Framework v3.0 Yes, Nasosoft Barcode for .NET supports .NET Framework 3.0.

.NET Framework v3.5 Yes, Nasosoft Barcode for .NET supports .NET Framework 3.5.

.NET Framework v4.0 Yes, Nasosoft Barcode for .NET supports .NET Framework 4.0.

Mono Yes, Nasosoft Barcode for .NET supports Mono on Windows and Linux.

Barcode Types

Page 6: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 2

Feature

Autrialia Post Barcode Yes

Bookland Barcode Yes

Codabar Barcode Yes

Code11 Barcode Yes

Code39 Barcode Yes

Code93 Barcode Yes

Code128 Barcode Yes

EAN8 Barcode Yes

EAN13 Barcode Yes

IATA 2 Of 5 Barcode Yes

Intelligent Mail Barcode Yes

Interleaved 2 Of 5 Barcode Yes

Matirx Barcode Yes

MSI Barcode Yes

Planet Barcode Yes

Postnet Barcode Yes

Standard 2 Of 5 Barcode Yes

UPCA Barcode Yes

UPCE Barcode Yes

PDF 417 Barcode Formatting

Feature

Text Font Yes

Page 7: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 3

Text Alignment Yes

Text Color Yes

Background Color Yes

Rotation Angle Yes

Border Yes

Margin Yes

Image Size Yes

Barcode Width and Height Yes

Customized Label Yes

Printing

Feature

Resolution Yes

Auto Size Yes

Graphics Unit Yes

Image Formats

Feature

JPEG Yes

BMP Yes

PNG Yes

GIF Yes

TIFF Yes

Metafile Yes

Reporting Services Platform

Page 8: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 4

Feature Description

SQL Server 2005 Yes.

SQL Server 2008 Yes.

SQL Server 2008 R2 Yes.

Install Nasosoft Barcode for .NET

System Requirements

Operating Systems

Operating System

Microsoft Windows 2000 Yes

Microsoft Windows XP (x86 and x64) Yes

Microsoft Windows Server 2003 (x86 and x64) Yes

Microsoft Windows Server 2003 R2 (x86 and x64) Yes

Microsoft Windows Server 2008 (x86 and x64) Yes

Microsoft Windows Server 2008 R2 (x86 and x64) Yes

Microsoft Windows Vista (x86 and x64) Yes

Microsoft Windows 7 (x86 and x64) Yes

Ubuntu Yes

Platforms

Platforms

Microsoft .NET Framework 2.0 Yes

Microsoft .NET Framework 3.0 Yes

Microsoft .NET Framework 3.5 Yes

Page 9: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 5

Microsoft .NET Framework 4.0 Yes

Mono Yes

Development Tools / IDE

Development Tools /IDE

Microsoft Visual Studio 2005 Yes

Microsoft Visual Studio 2008 Yes

Microsoft Visual Studio 2010 Yes

Borland C# Builder Yes

Mono Develop Yes

Sharp Develop Yes

Install and Uninstall Nasosoft Barcode for .NET

Nasosoft Barcode for .NET is distributed as a part of Naososoft .NET Components

MSI installer. You can use the installer to install and uninstall the components. The

installer performs following tasks:

Copy the Nasosoft Barcode component assemblies

Copy the sample projects with source code

Install the API documentation and programming guide.

Deploy Nasosoft Barcode for .NET

Nasosoft Barcode for .NET supports XCOPY deployment like other typical .NET

components. You can simply copy the Nasosoft Barcode assemblies to your

application bin folder.

Page 10: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 6

Getting Started with Nasosoft Barcode for

.NET

This section contains basic background information that will help you understand

and build your first .NET application with Nasosoft Barcode for .NET.

Download and Evaluate Nasosoft Barcode for .NET

Nasosoft Barcode for .NET is a collection of all the barcode components package

from Nasosoft, which includes:

Nasosoft Barcode for ASP.NET

Nasosoft Barcode for Windows Forms

Nasosoft Barcode for Windows Presentation Framework

Nasosoft Barcode for SQL Server Reporting Services

Nasosoft Barcode for Windows Phone

Nasosoft Barcode Reading for .NET

Download and install the Nasosoft Barcode for .NET Components Suite.

Note Before you install Nasosoft Barcode for .NET Components Suite, you

need to install .NET Framework 2.0 or later version, which you can

download at Microsoft Download Center.

The evaluation copy of the Nasosoft Barcode for .NET provides fully functions with

watermarks injection.

Page 11: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 7

Barcode with watermarks injection Barcode without watermarks

injection

Build your First App with Nasosoft Barcode for .NET

Below tutorial walks-through how to create, build and run your first .NET

application using C#.

Please follow the step by step tutorial to create a barcode application:

1. Create a new instance of Code39StandardBarcode class

2. Set the style of the barcode

3. Create a new instance of BarcodeImage class

4. Save the barcode to a bitmap.

Example:

[C#]

Code39StandardBarcode b = new Code39StandardBarcode("123456789"); b.BarcodeStyle.TextAlignment = StringAlignment.Center; b.BarcodeStyle.TopLabel.Text = "Code39 Standard Barcode"; b.BarcodeStyle.TopLabel.Visible = true; b.BarcodeStyle.TopLabel.TextAlignment = StringAlignment.Center; b.BarcodeStyle.ImageWidth = 100; BarcodeImage image = new BarcodeImage(b); image.Save("Code39StandardBarcode.bmp");

[VB.NET]

Page 12: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 8

Dim b Code39StandardBarcode = new Code39StandardBarcode("123456789") b.BarcodeStyle.TextAlignment = StringAlignment.Center b.BarcodeStyle.TopLabel.Text = "Code39 Standard Barcode" b.BarcodeStyle.TopLabel.Visible = true b.BarcodeStyle.TopLabel.TextAlignment = StringAlignment.Center b.BarcodeStyle.ImageWidth = 100 Dim image BarcodeImage = new BarcodeImage(b) image.Save("Code39StandardBarcode.bmp")

Explore and Study Code Samples

The code samples for Nasosoft Barcode for .NET are included in the MSI setup

package. You can explore and build the code sample easily.

How to Get Answers and Technical Support

Ask Your Questions on Forum

We have product forums for technical support and discussion. Our developers and

technical support engineers are responsive to reply the posts on the forums. If

you have any questions about Nasosoft Barcode for .NET, please feel free to post

your questions or concerns on our forums. We will get back to your timely.

Note You need to register an account on our website in order to get the

permission to submit your questions.

Get FREE Technical Email Support

We also provide FREE Email support service to our customers. If you have any

questions about Nasosoft Barcode for .NET, please feel free to email your

questions or concerns to [email protected].

This support service is completely FREE. It is available to all our product users and

customers. You don’t need to pay for it. You don’t need to purchase any of our

products. If you are using Nasosoft Barcode products, feel free to submit your

problems in emails to [email protected].

Page 13: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 9

Request Demo or Code Samples for FREE

We understand that people have different and variable product scenarios for

barcode programming. Our code samples and demo cannot cover all the possible

product scenarios. Therefore, we are more than glad to help our customers to

create demos or code samples. Please feel free to submit your specific product

scenarios or requirements on our forums or by email ([email protected]). Our

developers and support engineers will develop the demo and code samples for

your reference.

Request 30 Days FREE Trial License

You can get 30 days Trial License for free by submitting your request by email

([email protected]). Our sales will get back to you within 2 business days.

Page 14: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 10

Barcode Object Model

To develop barcode solution that use Nasosoft Barcode for .NET, you can interact

with the objects provides by the Nasosoft Barcode object model.

Each of barcode type maps to a barcode object in the Nasosoft Barcode object

model. For example, Code128Barcode object presents the implementation for

Code 128 Barcode Specification; Pdf417Barcode object presents the

implementation for the PDF 417 Barcode Specification.

The Nasosoft Barcode object model closely follows the industry Barcode

Specifications. You can easily understand the properties of the barcode object by

mapping the barcode specification document to the Nasosoft Barcode object

model.

The BarcodeWriter and BarcodeReader class is important because you need to use

them to generate a barcode image from a barcode object or recognize a barcode

from the images.

Each of these objects has many methods and properties that allow you to

manipulate and interact with it.

Page 15: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 11

Nasosoft Barcode object model provides many objects with which you can

interact. The following section briefly describes the top-level objects and how they

interact with each other. These include:

Barcode object

BarcodeStyle object

BarcodeImage object

BarcodeWriter object

BarcodeReader object

BarcodeObject Class

The BarcodeObject is the base class for all barcode objects. It presents a common

barcode object with the properties like barcode type, barcode data.

When you create a barcode image, you first create a specified barcode object. For

example, you create a Code128Barcode object to create a barcode image.

Page 16: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 12

Page 17: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 13

BarcodeStyle Class

The BarcodeStyle represents the style of a barcode image, for example, image

size, fonts, colors, rotation and etc. If you want to set the style of a barcode

image, you need to use BarcodeStyle object to modify the default settings.

Page 18: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 14

Page 19: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 15

BarcodeWriter Class

The BarcodeWriter represents an image writer that can write a barcode image to

specified image or graphics. You can use BarcodeWriter to draw barcode images to

the specified Graphic objects.

BarcodeImage Class

The BarcodeImage represents a barcode image. You can use it to easily save the

barcode into images with specified image format, file name, and etc.

BarcodeReader Class

The BarcodeReader represent a barcode reader that can recognize a barcode data

from a given image.

Page 20: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 16

Create Barcode Images

This section contains several topics about how to create barcode images.

Working with BarcodeImage Class

The BarcodeImage class provides many convenient methods to create a barcode

image. With specified file location and file format type, you can generate a

barcode image easily.

Save a Barcode bitmap to Specified Path

Code Example:

[C#]

Code39StandardBarcode b = new Code39StandardBarcode("123456789"); b.BarcodeStyle.TextAlignment = StringAlignment.Center; b.BarcodeStyle.TopLabel.Text = "Code39 Standard Barcode";

Page 21: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 17

b.BarcodeStyle.TopLabel.Visible = true; b.BarcodeStyle.TopLabel.TextAlignment = StringAlignment.Center; b.BarcodeStyle.ImageWidth = 100; BarcodeImage image = new BarcodeImage(b); image.Save("Code39StandardBarcode.bmp");

[VB.NET]

Dim b As Code39StandardBarcode = new Code39StandardBarcode("123456789") b.BarcodeStyle.TextAlignment = StringAlignment.Center b.BarcodeStyle.TopLabel.Text = "Code39 Standard Barcode" b.BarcodeStyle.TopLabel.Visible = true b.BarcodeStyle.TopLabel.TextAlignment = StringAlignment.Center b.BarcodeStyle.ImageWidth = 100 Dim image As BarcodeImage = new BarcodeImage(b) image.Save("Code39StandardBarcode.bmp")

Save a Barcode bitmap to Specified Stream

Code Example:

[C#]

Code39StandardBarcode b = new Code39StandardBarcode("123456789"); b.BarcodeStyle.TextAlignment = StringAlignment.Center; b.BarcodeStyle.TopLabel.Text = "Code39 Standard Barcode"; b.BarcodeStyle.TopLabel.Visible = true; b.BarcodeStyle.TopLabel.TextAlignment = StringAlignment.Center; b.BarcodeStyle.ImageWidth = 100;

Page 22: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 18

BarcodeImage image = new BarcodeImage(b); using(FileStream stream = File.OpenWrite("Code39StandardBarcode.bmp")) { image.Save(stream); }

[VB.NET]

Dim b As Code39StandardBarcode = new Code39StandardBarcode("123456789") b.BarcodeStyle.TextAlignment = StringAlignment.Center b.BarcodeStyle.TopLabel.Text = "Code39 Standard Barcode" b.BarcodeStyle.TopLabel.Visible = true b.BarcodeStyle.TopLabel.TextAlignment = StringAlignment.Center b.BarcodeStyle.ImageWidth = 100 Dim image As BarcodeImage = new BarcodeImage(b) Using stream As FileStream = File.OpenWrite("Code39StandardBarcode.bmp") image.Save(stream) End Using

Save a Barcode image to Specified Image Format

Code Example:

[C#]

Code39StandardBarcode b = new Code39StandardBarcode("123456789"); b.BarcodeStyle.TextAlignment = StringAlignment.Center; b.BarcodeStyle.TopLabel.Text = "Code39 Standard Barcode"; b.BarcodeStyle.TopLabel.Visible = true; b.BarcodeStyle.TopLabel.TextAlignment = StringAlignment.Center; b.BarcodeStyle.ImageWidth = 100;

Page 23: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 19

BarcodeImage image = new BarcodeImage(b); image.Save("Code39StandardBarcode.png",System.Drawing.Imaging.ImageFormat.Png);

[VB.NET]

Dim b As Code39StandardBarcode = new Code39StandardBarcode("123456789") b.BarcodeStyle.TextAlignment = StringAlignment.Center b.BarcodeStyle.TopLabel.Text = "Code39 Standard Barcode" b.BarcodeStyle.TopLabel.Visible = true b.BarcodeStyle.TopLabel.TextAlignment = StringAlignment.Center b.BarcodeStyle.ImageWidth = 100 Dim image As BarcodeImage = new BarcodeImage(b) image.Save("Code39StandardBarcode.png",System.Drawing.Imaging.ImageFormat.Png)

Working with BarcodeStyle Class

The BarcodeStyle class provides the capability to customize the appearance of a

barcode image, For example, Size, Color, Font, Labels, Rotation, and etc.

Change TopLable Style using BarcodeStyle.TopLabel

Code Example:

[C#]

Code39StandardBarcode b = new Code39StandardBarcode("123456789"); b.BarcodeStyle.TextAlignment = StringAlignment.Center;

Page 24: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 20

b.BarcodeStyle.TopLabel.Text = "Code39 Standard Barcode"; b.BarcodeStyle.TopLabel.Visible = true; b.BarcodeStyle.TopLabel.TextAlignment = StringAlignment.Center; b.BarcodeStyle.ImageWidth = 100; BarcodeImage image = new BarcodeImage(b); image.Save("Code39StandardBarcode.bmp");

[VB.NET]

Dim b As Code39StandardBarcode = new Code39StandardBarcode("123456789") b.BarcodeStyle.TextAlignment = StringAlignment.Center b.BarcodeStyle.TopLabel.Text = "Code39 Standard Barcode" b.BarcodeStyle.TopLabel.Visible = true b.BarcodeStyle.TopLabel.TextAlignment = StringAlignment.Center b.BarcodeStyle.ImageWidth = 100 Dim image As BarcodeImage = new BarcodeImage(b) image.Save("Code39StandardBarcode.bmp")

Change Barcode Image Size using BarcodeStyle.ImageWidth

Code Example:

[C#]

Code39StandardBarcode b = new Code39StandardBarcode("123456789"); b.BarcodeStyle.ImageWidth = 100; BarcodeImage image = new BarcodeImage(b); image.Save("Code39StandardBarcode.bmp");

[VB.NET]

Page 25: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 21

Dim b As Code39StandardBarcode = new Code39StandardBarcode("123456789") b.BarcodeStyle.ImageWidth = 100 Dim image As BarcodeImage = new BarcodeImage(b) image.Save("Code39StandardBarcode.bmp")

Change Barcode Color using ForeColor and BackgroundColor

Code Example:

[C#]

Code39StandardBarcode b = new Code39StandardBarcode("123456789"); b.BarcodeStyle.ForeColor = Sysem.Drawing.Color.Red; b.BarcodeStyle.BackgroundColor = Sysem.Drawing.Color.Yellow; BarcodeImage image = new BarcodeImage(b); image.Save("Code39StandardBarcode.bmp");

[VB.NET]

Dim b As Code39StandardBarcode = new Code39StandardBarcode("123456789") b.BarcodeStyle.ImageWidth = 100 b.BarcodeStyle.ForeColor = Sysem.Drawing.Color.Red; b.BarcodeStyle.BackgroundColor = Sysem.Drawing.Color.Yellow; Dim image As BarcodeImage = new BarcodeImage(b) image.Save("Code39StandardBarcode.bmp")

Page 26: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 22

Rotate a Barcode Image

Code Example:

[C#]

Code39StandardBarcode b = new Code39StandardBarcode("123456789"); b.BarcodeStyle.RotationAngle = RotationAngle.Degree90; BarcodeImage image = new BarcodeImage(b); image.Save("Code39StandardBarcode.bmp");

[VB.NET]

Dim b As Code39StandardBarcode = new Code39StandardBarcode("123456789") b.BarcodeStyle.ImageWidth = 100 b.BarcodeStyle.RotationAngle = RotationAngle.Degree90 Dim image As BarcodeImage = new BarcodeImage(b) image.Save("Code39StandardBarcode.bmp")

Page 27: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 23

Working with BarcodeWriter Class

The BarcodeWriter class provides the capability to draw a barcode image to

specified graphics or images.

Draw a barcode to the specified Graphics instance

Code Example:

[C#]

Code39StandardBarcode b = new Code39StandardBarcode("123456789"); b.BarcodeStyle.TextAlignment = StringAlignment.Center; b.BarcodeStyle.TopLabel.Text = "Code39 Standard Barcode"; b.BarcodeStyle.TopLabel.Visible = true; b.BarcodeStyle.TopLabel.TextAlignment = StringAlignment.Center; b.BarcodeStyle.ImageWidth = 100; Graphics g = Graphics.FromImage(p); BarcodeWriter writer = new BarcodeWriter(g); writer.Write(b, new Point(50,50));

[VB.NET]

Dim b As Code39StandardBarcode = new Code39StandardBarcode("123456789") b.BarcodeStyle.TextAlignment = StringAlignment.Center b.BarcodeStyle.TopLabel.Text = "Code39 Standard Barcode" b.BarcodeStyle.TopLabel.Visible = true b.BarcodeStyle.TopLabel.TextAlignment = StringAlignment.Center b.BarcodeStyle.ImageWidth = 100 Dim g As Graphics = Graphics.FromImage(p);

Page 28: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 24

Dim writer As BarcodeWriter = new BarcodeWriter(g) writer.Write(b, new Point(50,50))

Read Barcode Images

This section contains several topics about how to read a barcode from the image.

Working with BarcodeReader Classes

The BarcodeReader provides variable ways to read a barcode from specified file or

image object.

Read a barcode image with Specified Path

Code Example:

[C#]

using(var reader = new Code39StandardBarcodeReader("barcode.bmp")) { BarcodeObject[] barcodes = reader.Read(); if(barcodes.Length >0) Console.WriteLine(barcodes[0].Code); }

[VB.NET]

Using reader As new Code39StandardBarcodeReader("barcode.bmp") Dim barcodes As BarcodeObject = reader.Read() if(barcodes.Length >0) Console.WriteLine(barcodes(0).Code) End Using

Page 29: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 25

Read a barcode image with Specified Stream

Code Example:

[C#]

FileStream fs = File.OpenRead("barcode.bmp"); using(var reader = new Code39StandardBarcodeReader(fs)) { BarcodeObject[] barcodes = reader.Read(); if(barcodes.Length >0) Console.WriteLine(barcodes[0].Code); }

[VB.NET]

Dim fs As Stream = File.OpenRead("barcode.bmp") Using reader As new Code39StandardBarcodeReader(fs) Dim barcodes As BarcodeObject() = reader.Read() if(barcodes.Length >0) Console.WriteLine(barcodes(0).Code) End Using

Read a barcode image with Specified Bitmap object

Code Example:

[C#]

Bitmap image = new Bitmap("barcode.bmp"); using(var reader = new Code39StandardBarcodeReader(image)) { BarcodeObject[] barcodes = reader.Read(); if(barcodes.Length >0) Console.WriteLine(barcodes[0].Code); }

Page 30: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 26

[VB.NET]

Dim image As Bitmap = new Bitmap("barcode.bmp"); Using reader As new Code39StandardBarcodeReader(image) Dim barcodes As BarcodeObject() = reader.Read() if(barcodes.Length >0) Console.WriteLine(barcodes(0).Code) End Using

Barcodes in ASP.NET Applications

This section contains several topics about how to display a barcode image in

ASP.NET application.

Working with BarcodeWebControl Class

The BarcodeWebControl is a web control to generate and display barcode image in

ASP.NET Application. It allows developer to easily integrate the barcode

generation to their ASP.NET solution.

Please follow the step by step tutorial to create a barcode application:

1. Create an ASP.NET Application project in Visual Studio

2. Drag and drop the BarcodeWebControl control to the Form from the

toolbox

3. Select the BarcodeWebControl on the Form and set properties

Code Example:

[ASPX]

<%@ Page Language="C#" AutoEventWireup="true"

Page 31: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 27

CodeFile="Sample01.aspx.cs" Inherits="Nasosoft

Barcode.Samples.Csharp.Sample01" %>

<%@ Register assembly="Nasosoft Barcode.Writing.Web"

namespace="Nasosoft Barcode.Writing.Web" tagprefix="cc2"

%>

<%@ Register assembly="Nasosoft Barcode.Samples.Controls"

namespace="Nasosoft Barcode.Samples.Controls"

tagprefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0

Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-

transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">

<link href="~/css/Source.css" rel="stylesheet"

type="text/css" />

<link href="~/css/redmond/jquery-ui-1.7.2.custom.css"

rel="stylesheet" type="text/css" />

</head>

<body>

<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server">

<Scripts>

<asp:ScriptReference Path="~/Scripts/jquery-

1.3.2.min.js" />

<asp:ScriptReference

Path="~/Common/Resource/scripts/coda-slider.js" />

<asp:ScriptReference Path="~/Scripts/jquery-ui-

1.7.2.custom.min.js" />

<asp:ScriptReference Path="~/Scripts/Source.js"

/>

</Scripts>

</asp:ScriptManager>

<style></style>

<div>

<asp:Panel ID="Panel1" runat="server" >

</asp:Panel>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">

<ContentTemplate>

Page 32: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 28

<table width=800px>

<tr align=center valign=middle><td

align=center>

<table width=100%&amp;gt;&amp;lt;tr

align=center><td valign=middle>

<cc2:BarcodeWebControl ID="BarcodeWebControl1"

runat="server"

BarcodeType="Code128" Code="1234567890">

</cc2:BarcodeWebControl><br />

Info:&nbsp;&nbsp;<asp:Label ID="Label1"

runat="server" Text="A barcode demo."

ForeColor="Blue"></asp:Label>

</td></tr></table>

<table>

<tr>

<td align=left>

Code:<br /><asp:TextBox ID="TextBox1"

runat="server" BackColor="#FFFFCC"

BorderColor="#000066" BorderStyle="Solid"

BorderWidth="1px">1234567890</asp:TextBox><br />

Barcode type:<br />

<asp:DropDownList ID="DropDownList1"

runat="server" BackColor="#FFFFCC">

<asp:ListItem>Code128</asp:ListItem>

<asp:ListItem>Code11</asp:ListItem>

<asp:ListItem>AustraliaPost</asp:ListItem>

<asp:ListItem>BooklandEAN</asp:ListItem>

<asp:ListItem>Codabar</asp:ListItem>

<asp:ListItem>Code39Extended</asp:ListItem>

<asp:ListItem>Code39Standard</asp:ListItem>

<asp:ListItem>Code93Extended</asp:ListItem>

<asp:ListItem>EAN8</asp:ListItem>

<asp:ListItem>Interleaved2Of5</asp:ListItem>

<asp:ListItem>PDF417</asp:ListItem>

<asp:ListItem>Planet</asp:ListItem>

Page 33: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 29

<asp:ListItem>Postnet</asp:ListItem>

</asp:DropDownList><br />Tooltip:<br />

<asp:TextBox ID="TextBox2" runat="server"

BackColor="#FFFFCC"

BorderColor="#000066" BorderStyle="Solid"

BorderWidth="1px">This is a tooltip.</asp:TextBox>

<br />

</td>

<td>Bar Height:<br />

<asp:TextBox ID="TextBox3" runat="server"

BackColor="#FFFFCC"

BorderColor="#000066" BorderStyle="Solid"

BorderWidth="1px">15</asp:TextBox>

<br />

WideNarrowRatio:<br />

<asp:TextBox ID="TextBox4" runat="server"

BackColor="#FFFFCC"

BorderColor="#000066" BorderStyle="Solid"

BorderWidth="1px">3</asp:TextBox><br />

SupplementData:<br />

<asp:TextBox ID="TextBox5"

runat="server" BackColor="#FFFFCC"

BorderColor="#000066" BorderStyle="Solid"

BorderWidth="1px"></asp:TextBox>

<br />

</td>

</tr>

<tr>

<td colspan=2>

<asp:Button ID="Button1" runat="server"

Text="Update" onclick="Button1_Click" />

</td>

</tr>

</table>

</td></tr>

</table>

</ContentTemplate>

Page 34: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 30

</asp:UpdatePanel>

<cc1:TogglePanel ID="tab" Title="" runat="server">

<cc1:SourceCodeTab ID="slider" runat="server" />

</cc1:TogglePanel>

</div>

</form>

</body>

</html>

[C#]

public partial class Sample01 : SourceProviderPageBase {

protected void Page_Load(object sender, EventArgs

e)

{

}

protected void Button1_Click(object sender,

EventArgs e)

{

string code = this.TextBox1.Text;

string btypes = this.DropDownList1.Text;

Nasosoft Barcode.Writing.Web.BarcodeType

barcodeType = BarcodeType.Code128;

try

{

barcodeType = new BarcodeType(btypes);

this.BarcodeWebControl1.BarcodeType =

barcodeType;

Page 35: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 31

this.BarcodeWebControl1.ToolTip =

this.TextBox2.Text;

this.BarcodeWebControl1.BarcodeStyle.BarHeight =

int.Parse(this.TextBox3.Text);

this.BarcodeWebControl1.BarcodeStyle.WideNarrowRatio =

int.Parse(this.TextBox4.Text);

this.BarcodeWebControl1.BarcodeStyle.SetDirty();

this.BarcodeWebControl1.Code =

this.TextBox1.Text;

this.BarcodeWebControl1.SecondaryCode =

this.TextBox5.Text;

this.Label1.Text =

this.BarcodeWebControl1.BarcodeType.ToString() + "[" +

this.BarcodeWebControl1.Code +

"]";

}

catch (Exception ex)

{

this.Label1.Text = ex.Message;

}

}

}

}

[VB.NET]

Namespace Nasosoft Barcode.Samples.VB

Partial Class Sample01

Inherits SourceProviderPageBase

Page 36: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 32

''' <summary>

''' Handles the page load

''' </summary>

''' <param name="sender"></param>

''' <param name="e"></param>

Protected Sub Page_Load(ByVal sender As Object,

ByVal e As EventArgs)

End Sub

Protected Sub Button1_Click(ByVal sender As Object,

ByVal e As EventArgs)

Dim code As String = Me.TextBox1.Text

Dim btypes As String = Me.DropDownList1.Text

Dim barcodetype As BarcodeType =

barcodetype.Code128

Try

barcodetype = New BarcodeType(btypes)

BarcodeWebControl1.BarcodeType = barcodetype

BarcodeWebControl1.BarcodeType = barcodetype

BarcodeWebControl1.ToolTip = TextBox2.Text

BarcodeWebControl1.BarcodeStyle.BarHeight =

System.Int32.Parse(TextBox3.Text)

BarcodeWebControl1.BarcodeStyle.WideNarrowRatio =

System.Int32.Parse(TextBox4.Text)

BarcodeWebControl1.BarcodeStyle.SetDirty()

BarcodeWebControl1.Code = TextBox1.Text

BarcodeWebControl1.SecondaryCode =

TextBox5.Text

Label1.Text =

BarcodeWebControl1.BarcodeType.ToString() + "[" &

BarcodeWebControl1.Code & "]"

Catch ex As Exception

Label1.Text = ex.Message

Page 37: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 33

End Try

End Sub

End Class

End Namespace

Info: A barcode demo.

Code:

1234567890

Barcode type:

Code128

Tooltip:

This is a tool

Bar Height:

15

WideNarrowRatio:

3

SupplementData:

Update

Barcodes in Windows Form Applications

Working with BarcodeWinControl Classes

The BarcodeWinControl is a Windows Form Control to generate and display

barcode images in Windows Form Applications. It allows developer to easily

integrate the barcode generation to their Windows Form application.

Please follow the step by step tutorial to create a barcode application:

4. Create a Windows Forms Application project in Visual Studio

5. Drag and drop the BarcodeWinControl control to the Form from the toolbox

6. Select the BarcodeWinControl on the Form and set properties

Page 38: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 34

Code Example:

[C#]

BarcodeBuilder.cs

using Nasosoft Barcode.Writing.WindowsForms; namespace CSBarcodeWindowsForms { partial class BarcodeBuilder : Form { public BarcodeBuilder() { InitializeComponent(); this.propertyGrid1.SelectedObject = barcodeWinControl1.BarcodeStyle; } private void btnApply_Click(object sender, EventArgs e) { BarcodeType btype = BarcodeType.FromString(this.cmboBarcodeType.SelectedText); if (!btype.IsUnknown()) { System.Diagnostics.Debug.WriteLine("Selected BarcodeType:" + btype.ToString()); this.barcodeWinControl1.BarcodeType = btype; } this.barcodeWinControl1.Code = this.txtBarcodeCode.Text; this.Invalidate(barcodeWinControl1.Region); } private void BarcodeCustomReportItemBuilder_Load(object sender, EventArgs e) { this.txtBarcodeCode.Text = barcodeWinControl1.Code;

Page 39: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 35

string[] barcodeTypeNames = Enum.GetNames(typeof(BarcodeTypeEnum)); this.cmboBarcodeType.Items.Add("..."); this.cmboBarcodeType.Items.AddRange(barcodeTypeNames); this.cmboBarcodeType.SelectedIndex = Array.IndexOf(barcodeTypeNames, barcodeWinControl1.BarcodeType.Value.ToString()) + 1; this.Invalidate(barcodeWinControl1.Region); } private void cmboBarcodeType_SelectedIndexChanged(object sender, EventArgs e) { if (this.cmboBarcodeType.SelectedItem != null) { BarcodeType btype = BarcodeType.FromString((string)this.cmboBarcodeType.SelectedItem); if (!btype.IsUnknown()) { System.Diagnostics.Debug.WriteLine("Selected BarcodeType:" + btype.ToString()); this.barcodeWinControl1.BarcodeType = btype; this.Invalidate(barcodeWinControl1.Region); } } } private void btnSave_Click(object sender, EventArgs e) { SaveFileDialog dialog = new SaveFileDialog(); if (dialog.ShowDialog() == DialogResult.OK) { barcodeWinControl1.Barcode.Save(dialog.FileName); } }

Page 40: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 36

private void btnClose_Click(object sender, EventArgs e) { this.Close(); } } }

[C#]

BarcodeBuilder.Designer.cs

namespace CSBarcodeWindowsForms { partial class BarcodeBuilder { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code

Page 41: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 37

/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { BarcodeStyle barcodeStyle1 = new BarcodeStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BarcodeBuilder)); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.panel1 = new System.Windows.Forms.Panel(); this.barcodeWinControl1 = new Nasosoft Barcode.Writing.WindowsForms.BarcodeWinControl(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.Data = new System.Windows.Forms.TabPage(); this.button2 = new System.Windows.Forms.Button(); this.cmboBarcodeType = new System.Windows.Forms.ComboBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.txtBarcodeCode = new System.Windows.Forms.TextBox(); this.Style = new System.Windows.Forms.TabPage(); this.propertyGrid1 = new System.Windows.Forms.PropertyGrid(); this.panel3 = new System.Windows.Forms.Panel(); this.btnClose = new System.Windows.Forms.Button(); this.btnSave = new System.Windows.Forms.Button(); this.btnApply = new System.Windows.Forms.Button(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.panel1.SuspendLayout(); this.tabControl1.SuspendLayout();

Page 42: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 38

this.Data.SuspendLayout(); this.Style.SuspendLayout(); this.panel3.SuspendLayout(); this.SuspendLayout(); // // tableLayoutPanel1 // this.tableLayoutPanel1.ColumnCount = 2; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 60F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 40F)); this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 0); this.tableLayoutPanel1.Controls.Add(this.tabControl1, 1, 0); this.tableLayoutPanel1.Controls.Add(this.panel3, 1, 1); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 2; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 31F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(780, 452); this.tableLayoutPanel1.TabIndex = 0; // // tableLayoutPanel2 // this.tableLayoutPanel2.ColumnCount = 1; this.tableLayoutPanel2.ColumnStyles.Add(new System.

Page 43: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 39

Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel2.Controls.Add(this.panel1, 0, 0); this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.RowCount = 2; this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 0F)); this.tableLayoutPanel2.Size = new System.Drawing.Size(462, 415); this.tableLayoutPanel2.TabIndex = 0; // // panel1 // this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panel1.Controls.Add(this.barcodeWinControl1); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(3, 3); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(456, 409); this.panel1.TabIndex = 0; // // barcodeWinControl1 // this.barcodeWinControl1.AztectErrorLevel = 12; barcodeStyle1.AspectRatio = 1F; barcodeStyle1.BackgroundColor = System.Drawing.Color.White;

Page 44: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 40

barcodeStyle1.BarHeight = 15F; barcodeStyle1.TopLabel= new Label("", false, System.Drawing.StringAlignment.Near, 0F, System.Drawing.Color.Black, new System.Drawing.Font("Arial", 8F)); barcodeStyle1.Dimension = new Dimension(0.6F, 2F); barcodeStyle1.ForeColor = System.Drawing.Color.Black; barcodeStyle1.GraphicsUnit = System.Drawing.GraphicsUnit.Millimeter; barcodeStyle1.ImageFitMode = ImageFitMode.Flow; barcodeStyle1.ImageHeight = 60F; barcodeStyle1.ImageWidth = 100F; barcodeStyle1.Margins = new MarginsF(4F, 4F, 4F, 4F); barcodeStyle1.Resolution = new Resolution(96F, 96F); barcodeStyle1.RotationAngle = RotationAngle.Degree0; barcodeStyle1.SecondaryBarHeight = 5F; barcodeStyle1.SupplementSpace = 4F; barcodeStyle1.TextAlignment = System.Drawing.StringAlignment.Center; barcodeStyle1.TextColor = System.Drawing.Color.Black; barcodeStyle1.TextFont = new System.Drawing.Font("Arial", 8F); barcodeStyle1.TextSpace = 1F; barcodeStyle1.TextVisible = true; barcodeStyle1.WideNarrowRatio = 3F; this.barcodeWinControl1.BarcodeStyle = barcodeStyle1; this.barcodeWinControl1.BarcodeType = new BarcodeType("Code39Extended"); this.barcodeWinControl1.CodabarStartCharacter = CodabarStartStopCharacter.A; this.barcodeWinControl1.CodabarStopCharacter = CodabarStartStopCharacter.A; this.barcodeWinControl1.Code = "012345678"; this.barcodeWinControl1.Code128CharacterSet = Code128CharacterSet.Auto;

Page 45: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 41

this.barcodeWinControl1.DataMatrixEncodingMode = DataMatrixEncodingMode.Auto; this.barcodeWinControl1.Location = new System.Drawing.Point(5, 42); this.barcodeWinControl1.Name = "barcodeWinControl1"; this.barcodeWinControl1.PDF417CompactionMode = PDF417CompactionMode.Auto; this.barcodeWinControl1.PDF417ErrorLevel = PDF417ErrorLevel.Level0; this.barcodeWinControl1.Pdf417Truncate = false; this.barcodeWinControl1.QRCodeEncodingMode = QRCodeEncodingMode.Auto; this.barcodeWinControl1.QRCodeErrorLevel = QRCodeErrorLevel.LevelL; this.barcodeWinControl1.SecondaryCode = null; this.barcodeWinControl1.Size = new System.Drawing.Size(365, 112); this.barcodeWinControl1.TabIndex = 0; this.barcodeWinControl1.Text = "barcodeWinControl1"; // // tabControl1 // this.tabControl1.Controls.Add(this.Data); this.tabControl1.Controls.Add(this.Style); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Location = new System.Drawing.Point(471, 3); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(306, 415); this.tabControl1.TabIndex = 1; // // Data // this.Data.Controls.Add(this.button2); this.Data.Controls.Add(this.cmboBarcodeType);

Page 46: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 42

this.Data.Controls.Add(this.label2); this.Data.Controls.Add(this.label1); this.Data.Controls.Add(this.button1); this.Data.Controls.Add(this.txtBarcodeCode); this.Data.Location = new System.Drawing.Point(4, 22); this.Data.Name = "Data"; this.Data.Padding = new System.Windows.Forms.Padding(3); this.Data.Size = new System.Drawing.Size(298, 389); this.Data.TabIndex = 0; this.Data.Text = "Data"; this.Data.UseVisualStyleBackColor = true; // // button2 // this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button2.Image = ((System.Drawing.Image)(resources.GetObject("button2.Image"))); this.button2.Location = new System.Drawing.Point(252, 52); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(38, 23); this.button2.TabIndex = 5; this.button2.Text = "fx"; this.button2.UseVisualStyleBackColor = true; // // cmboBarcodeType // this.cmboBarcodeType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmboBarcodeType.FormattingEnabled = true; this.cmboBarcodeType.Location = new System.Drawing.Point(48, 53); this.cmboBarcodeType.Name = "cmboBarcodeType"; this.cmboBarcodeType.Size = new System.Drawing.Size(197, 21);

Page 47: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 43

this.cmboBarcodeType.TabIndex = 4; this.cmboBarcodeType.SelectedIndexChanged += new System.EventHandler(this.cmboBarcodeType_SelectedIndexChanged); // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(11, 57); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(34, 13); this.label2.TabIndex = 3; this.label2.Text = "Type:"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(10, 28); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(35, 13); this.label1.TabIndex = 2; this.label1.Text = "Code:"; // // button1 // this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button1.Image = ((System.Drawing.Image)(resources.GetObject("button1.Image"))); this.button1.Location = new System.Drawing.Point(250, 24); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(40, 23); this.button1.TabIndex = 1; this.button1.Text = "fx"; this.button1.UseVisualStyleBackColor = true; //

Page 48: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 44

// txtBarcodeCode // this.txtBarcodeCode.Location = new System.Drawing.Point(47, 25); this.txtBarcodeCode.Name = "txtBarcodeCode"; this.txtBarcodeCode.Size = new System.Drawing.Size(197, 20); this.txtBarcodeCode.TabIndex = 0; // // Style // this.Style.Controls.Add(this.propertyGrid1); this.Style.Location = new System.Drawing.Point(4, 22); this.Style.Name = "Style"; this.Style.Padding = new System.Windows.Forms.Padding(3); this.Style.Size = new System.Drawing.Size(298, 389); this.Style.TabIndex = 1; this.Style.Text = "Style"; this.Style.UseVisualStyleBackColor = true; // // propertyGrid1 // this.propertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill; this.propertyGrid1.Location = new System.Drawing.Point(3, 3); this.propertyGrid1.Name = "propertyGrid1"; this.propertyGrid1.Size = new System.Drawing.Size(292, 383); this.propertyGrid1.TabIndex = 0; // // panel3 // this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panel3.Controls.Add(this.btnClose); this.panel3.Controls.Add(this.btnSave);

Page 49: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 45

this.panel3.Controls.Add(this.btnApply); this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; this.panel3.Location = new System.Drawing.Point(471, 424); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(306, 25); this.panel3.TabIndex = 2; // // btnClose // this.btnClose.Dock = System.Windows.Forms.DockStyle.Right; this.btnClose.Location = new System.Drawing.Point(79, 0); this.btnClose.Name = "btnClose"; this.btnClose.Size = new System.Drawing.Size(75, 23); this.btnClose.TabIndex = 2; this.btnClose.Text = "&Close"; this.btnClose.UseVisualStyleBackColor = true; this.btnClose.Click += new System.EventHandler(this.btnClose_Click); // // btnSave // this.btnSave.Dock = System.Windows.Forms.DockStyle.Right; this.btnSave.Location = new System.Drawing.Point(154, 0); this.btnSave.Name = "btnSave"; this.btnSave.Size = new System.Drawing.Size(75, 23); this.btnSave.TabIndex = 1; this.btnSave.Text = "&Save"; this.btnSave.UseVisualStyleBackColor = true; this.btnSave.Click += new System.EventHandler(this.btnSave_Click); //

Page 50: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 46

// btnApply // this.btnApply.Dock = System.Windows.Forms.DockStyle.Right; this.btnApply.Location = new System.Drawing.Point(229, 0); this.btnApply.Name = "btnApply"; this.btnApply.Size = new System.Drawing.Size(75, 23); this.btnApply.TabIndex = 0; this.btnApply.Text = "&Apply"; this.btnApply.UseVisualStyleBackColor = true; this.btnApply.Click += new System.EventHandler(this.btnApply_Click); // // BarcodeBuilder // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(780, 452); this.Controls.Add(this.tableLayoutPanel1); this.HelpButton = true; this.Name = "BarcodeBuilder"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Barcode Designer"; this.Load += new System.EventHandler(this.BarcodeCustomReportItemBuilder_Load); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel2.ResumeLayout(false); this.panel1.ResumeLayout(false); this.tabControl1.ResumeLayout(false); this.Data.ResumeLayout(false); this.Data.PerformLayout(); this.Style.ResumeLayout(false); this.panel3.ResumeLayout(false); this.ResumeLayout(false);

Page 51: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 47

} #endregion private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage Data; private System.Windows.Forms.TabPage Style; private System.Windows.Forms.Panel panel1; private Nasosoft Barcode.Writing.WindowsForms.BarcodeWinControl barcodeWinControl1; private System.Windows.Forms.PropertyGrid propertyGrid1; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.Button btnSave; private System.Windows.Forms.Button btnApply; private System.Windows.Forms.Button btnClose; private System.Windows.Forms.Button button2; private System.Windows.Forms.ComboBox cmboBarcodeType; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button1; private System.Windows.Forms.TextBox txtBarcodeCode; } }

Page 52: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 48

Barcodes in SQL Server Reporting Services

Add Barcode to Your Report

Drag and Drop Barcode to Report

Open the Toolbox in the Visual Studio IDE

Select the Nasosoft Barcodes.ReportingServices CustomItem in the

Toolbox

Page 53: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 49

Page 54: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 50

Page 55: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 51

Drag and Drop the Nasosoft Barcodes.ReportingServices CustomItem to

Report

Page 56: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 52

Drag and Drop the Nasosoft Barcodes.ReportingServices CustomReportItem to

your report

Working with Barcode Designer

Right click on the barcode item

Page 57: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 53

Click the “Properties” menu and the Barcode Designer will be popped up

Bound the “Code” to a data field if need

Page 58: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 54

Create Your First Barcode Report

Create a new SQL Server Reporting project

Add a new report to the project

Page 59: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 55

Setup the data source with Report Wizard step by step

Page 60: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 56

Page 61: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 57

Page 62: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 58

Select the Report Type and Table Style

Page 63: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 59

Page 64: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 60

Review the setting

Page 65: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 61

Insert a new column for displaying the barcode image

Page 66: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 62

Drag and Drop the Barcode ReportItem to the new column

Right click on the Barcode Item and select the “Properties..” menu to open

the Designer

Page 67: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 63

Binding a field to the “Code” property of the barcode item

Page 68: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 64

Save the page then click “Preview”

Page 69: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 65

Deploy the report to SSRS

Page 70: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 66

View the report via browser

Page 71: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 67

Configure Barcode for Reporting Services

Configure with Barcode Configuration Tool

Nasosoft Barcodes.ConfigTool is a Windows Form application that helps you to

setup the environments of Microsoft Visual Studio and Microsoft SQL Server

Reporting Services.

Run Nasosoft Barcodes.ConfigTool.exe from the start menu, or you can

find it at the Tools folder of the Nasosoft components setup folder.

Following the wizard, check your options and simply click next.

The tool will do the configuration automatically

Page 72: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 68

Page 73: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 69

Manually Configure Visual Studio

Copy Nasosoft Barcodes.ReportingServices.dll to the PrivateAssemblies folder of

your IDE. PrivateAssemblies folder of Visual Studio. It is usually at C:\Program

Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies

folder.

Register Nasosoft Barcodes as a custom report item in the

RSReportDesigner.config and RSReportDesigner.config file.

1. Open and edit the C:\Program Files\Microsoft Visual Studio

9.0\Common7\IDE\PrivateAssemblies\RSPreviewPolicy.confg as below:

<configuration>

<mscorlib>

<security>

<policy>

<PolicyLevel version="1">

......

<CodeGroup class="FirstMatchCodeGroup" version="1" PermissionSetName="Nothing">

<IMembershipCondition class="AllMembershipCondition" version="1" />

......

<CodeGroup class="FirstMatchCodeGroup" version="1" PermissionSetName="Execution" Description="This code

group grants MyComputer code Execution permission. ">

<IMembershipCondition class="ZoneMembershipCondition" version="1" Zone="MyComputer" />

<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust"

Name="NasosoftBarcode" Description="Nasosoft Barcodes.ReportingServices">

<IMembershipCondition class="StrongNameMembershipCondition" version="1"

PublicKeyBlob="002400000480000094000000060200000024000052534131000400000100010087200c09b2a6349d851af24

c8b638fe050392ba2070ecdb25f0e5f0ecee90dc66822deed7bd8774519835823fb53a8d5600a06931b3e056dd0dc824cfe97d

160baa7846f825a084ba8f0195f396aa8e8f404bb9d472ac78487d849b6abe81ad8266ab00bb0eb176f846841538de134d82cf

9e82a6c782fdfd6a3abed665df8ee" />

</CodeGroup>

</CodeGroup>

</CodeGroup>

</PolicyLevel>

</policy>

</security>

</mscorlib>

</configuration>

Page 74: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 70

2. Open and edit the C:\Program Files\Microsoft Visual Studio

9.0\Common7\IDE\PrivateAssemblies\RSReportDesigner.confg as below:

<Configuration>

<!-- Configuration for Report Designer in Business Intelligence Development Studio -->

<Add Key="SecureConnectionLevel" Value="0" />

<Add Key="InstanceName" Value="Microsoft.ReportingServices.PreviewServer" />

<Add Key="SessionCookies" Value="true" />

<Add Key="SessionTimeoutMinutes" Value="3" />

<Add Key="PolicyLevel" Value="rspreviewpolicy.config" />

<Add Key="CacheDataForPreview" Value="true" />

<Extensions>

......

<ReportItemDesigner>

<ReportItem Name="NasosoftBarcode" Type="Nasosoft

Barcodes.ReportingServices.BarcodeCustomReportItemDesigner, Nasosoft Barcodes.ReportingServices" />

</ReportItemDesigner>

<ReportItems>

<ReportItem Name="NasosoftBarcode" Type="Nasosoft

Barcodes.ReportingServices.BarcodeCustomReportItem, Nasosoft Barcodes.ReportingServices" />

</ReportItems>

</Extensions>

</Configuration>

Manually Configure SQL Server 2008 Reporting Services

Copy Nasosoft Barcodes.ReportingServices.dll to the bin folder of SQL Server

Reporting Servies. It is usually at C:\Program Files\Microsoft SQL

Server\MSRS10_50.SQL08R2\Reporting Services\ReportServer\bin

folder.

Register Nasosoft Barcodes in the rssrvpolicy.config and the

rsreportserver .config file.

1. Open and edit the C:\Program Files\Microsoft

SQLServer\MSSQL.x\Reporting Services\ReportServer\rssrvpolicy.config as

below:

<configuration>

<mscorlib>

<security>

<policy>

Page 75: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 71

<PolicyLevel version="1">

......

<CodeGroup class="FirstMatchCodeGroup" version="1" PermissionSetName="Nothing">

<IMembershipCondition class="AllMembershipCondition" version="1" />

......

<CodeGroup class="FirstMatchCodeGroup" version="1" PermissionSetName="Execution"

Description="This code group grants MyComputer code Execution permission. ">

<IMembershipCondition class="ZoneMembershipCondition" version="1" Zone="MyComputer" />

......

<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust"

Name="NasosoftBarcode" Description="Nasosoft Barcodes.ReportingServices">

<IMembershipCondition class="StrongNameMembershipCondition" version="1"

PublicKeyBlob="002400000480000094000000060200000024000052534131000400000100010087200c09b2a

6349d851af24c8b638fe050392ba2070ecdb25f0e5f0ecee90dc66822deed7bd8774519835823fb53a8d5600a06

931b3e056dd0dc824cfe97d160baa7846f825a084ba8f0195f396aa8e8f404bb9d472ac78487d849b6abe81ad82

66ab00bb0eb176f846841538de134d82cf9e82a6c782fdfd6a3abed665df8ee" />

</CodeGroup>

</CodeGroup>

</CodeGroup>

</PolicyLevel>

</policy>

</security>

</mscorlib>

</configuration>

2. Open and edit the C:\Program Files\Microsoft

SQLServer\MSSQL.x\Reporting Services\ReportServer\rsreportserver.config

as below:

<configuration>

<Configuration>

......

<Extensions>

......

<ReportItems>

<ReportItem Name="NasosoftBarcode" Type="Nasosoft

Barcodes.ReportingServices.BarcodeCustomReportItem, Nasosoft Barcodes.ReportingServices" />

</ReportItems>

</Extensions>

......

</Configuration>

Page 76: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 72

Code128 Barcode

Code128 Overview

Code 128 Barcode is a linear barcode, which is capable of encoding the full 128-character ASCII character set and extended character sets.

Code 128 Barcode is well known as ANSI/AIM 128, ANSI/AIM Code 128, USS Code 128, Uniform Symbology Specification Code 128, Code 128 Code Set A, Code 128 Code Set B, Code 128 Code Set C, Code 128A, Code 128B, Code 128C, and etc.

Code128 Code Sets

Code Set A (or Chars Set A) includes all of the standard upper case U.S. alphanumeric

keyboard characters and punctuation characters together with the control characters, (i.e. characters with ASCII values from 0 to 95 inclusive), and seven special characters.

Code Set B (or Chars Set B) includes all of the standard upper case alphanumeric keyboard

characters and punctuation characters together with the lower case alphabetic characters (i.e. characters with ASCII values from 32 to 127 inclusive), and seven special characters.

Code Set C (or Chars Set C) includes the set of 100 digit pairs from 00 to 99 inclusive, as well

as three special characters. This allows numeric data to be encoded as two data digits per symbol character, at effectively twice the density of standard data.

How to Create Code 128 Barcode through .NET

Windows Form Control in C# or VB.NET?

Add Reference Nasosoft Barcodes.dll to your project. o Right click the project and select the menu "Add Reference ...” o Add Nasosoft Barcodes.dll to your project.

Add Barcode Windows Control to your Visual Studio Toolbox. o Open Toolbox in Visual Studio. Click menu View, and check submenu Toolbox. o Right click Toolbox, click menu Choose Items... o Go to .NET Framework Components tab.

o Click Browse... button and select Nasosoft Barcodes.dll file.

o Select the component BarcodeWinControl

Now you can see the component displayed on Toolbox. You can drag BarcodeWinControl on

your form,

Select the BarcodeWinControl on the windows form, and go to properties window to change barcode settings. For example, you can change the Code property to set barcode data

Set BarcodeType property to BarcodeType.Code128

Expand the BarcodeStyle property in the properties windows, you can now set the barcode style settings for the barcode image

Page 77: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 73

How to Create Code 128 Barcode Image in .NET class?

Add Reference Nasosoft Barcodes.dll to your .NET project (ASP.NET website, Forms, any

.NET project) in your .NET class.

Create a Code128Barcode instance.

Save the barcode to images using BarcodeImage class.

[VB.NET]

Dim b As Code128Barcode = new Code128Barcode("123456789") b.CharacterSet = Code128CharacterSet.Auto Dim image As BarcodeImage = new BarcodeImage(b) image.Save("Code128AutoBarcode.bmp")

[C#]

Code128Barcode b = new Code128Barcode("123456789"); b.CharacterSet = Code128CharacterSet.Auto; BarcodeImage image = new BarcodeImage(b); image.Save("Code128AutoBarcode.bmp");

How to Save Code 128 Barcode Image using .NET

Barcode Generator Windows Control?

Use BarcodeWinControl.Save function to save barcode into images.

Code128 Barcode Settings

Set the Type property to BarcodeType.Code128.

Set the Code128CharacterSet to specified code set,

Code128CharacterSet.Default: automatically choose the best code set for maximum

data compression rate. For example, if the data contains only digits it will use code set C.

Code128CharacterSet.A: Encode the Character Set A which only supports ASCII

values from 0 to 95

Page 78: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 74

Code128CharacterSet.B: Encode the Character Set B which only supports ASCII

values from 32 to 127

Code128CharacterSet.C: Encode the Character Set C which only supports pairs of

digits

Set the Code property with the value to encode.

Code39 Barcode

Code39 Overview

Code 39 Barcode is a linear barcode, which is capable of encoding the full 128-character ASCII character set and extended character sets.

Code 39 Barcode is well known as ANSI/AIM Code 39, ANSI/AIM Code 39, USS Code 39, USS 39, Code 3/9, Code 3 of 9, USD-3, LOGMARS, Alpha39, Code 39 Extended, and Code 39 Full ASCII.

Code39 Standard and Code39 Extended

Code39 Barcode Standard can encode uppercase letters (A through Z), digits (0

through 9) and a handful of special characters like the *, -, $, %, (Space), ., /, and +

Code39 Barcode Extended can encode full 128-character ASCII character set and

extended character sets

How to Create Code 39 Barcode through .NET Windows

Form Control in C# or VB.NET?

Add Reference Nasosoft Barcodes.dll to your project. o Right click the project and select the menu "Add Reference ...” o Add Nasosoft Barcodes.dll to your project.

Add Barcode Windows Control to your Visual Studio Toolbox. o Open Toolbox in Visual Studio. Click menu View, and check submenu Toolbox. o Right click Toolbox, click menu Choose Items... o Go to .NET Framework Components tab.

o Click Browse... button and select Nasosoft Barcodes.dll file.

o Select the component BarcodeWinControl

Now you can see the component displayed on Toolbox. You can drag BarcodeWinControl on

your form,

Select the BarcodeWinControl on the windows form, and go to properties window to change barcode settings. For example, you can change the Code property to set barcode data

Set BarcodeType property to BarcodeType.Code39Standard or BarcodeType.Code39Extended

Page 79: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 75

Expand the BarcodeStyle property in the properties windows, you can now set the barcode style settings for the barcode image

How to Create Code 39 Barcode Image in .NET class?

Add Reference Nasosoft Barcodes.dll to your .NET project (ASP.NET website, Forms, any

.NET project) in your .NET class.

Create a Code39StandardBarcode instance.

Save the barcode to images using BarcodeImage class.

[VB.NET]

Dim b As Code39StandardBarcode = new Code39StandardBarcode ("123456789") Dim image As BarcodeImage = new BarcodeImage(b) image.Save("Code39Barcode.bmp")

[C#]

Code39StandardBarcode b = new Code39StandardBarcode("123456789"); BarcodeImage image = new BarcodeImage(b); image.Save("Code39Barcode.bmp");

How to Save Code 39 Barcode Image using .NET

Barcode Generator Windows Control?

Use BarcodeWinControl.Save function to save barcode into images.

Code39 Barcode Settings

Set the Type property to BarcodeType.Code39Standard or BarcodeType.Code39Extended.

Set the Code property with the value to encode.

Page 80: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 76

Code39 Barcode Style Settings

Set the WidthNarrowRatio property to change the default width bar and narrow bar ratio 3:1.

Code93 Barcode

Code93 Overview

Code 93 Barcode is a linear barcode, which is capable of encoding the full 128-character ASCII character set and extended character sets.

Code 93 Barcode is well known as ANSI/AIM Code 93, ANSI/AIM Code 93, Uniform Symbology Specification Code 93, USS Code 93, USS 93, Code 9/3, USS-93, USD-3, Code 93 Extended, and Code 93 Full ASCII.

Code93 Standard and Code93 Extended

Code93 Barcode Standard can encode uppercase letters (A through Z), digits (0

through 9) and a handful of special characters like the *, -, $, %, (Space), ., /, and +

Code93 Barcode Extended can encode full 128-character ASCII character set and

extended character sets

How to Create Code 93 Barcode through .NET Windows

Form Control in C# or VB.NET?

Add Reference Nasosoft Barcodes.dll to your project. o Right click the project and select the menu "Add Reference ...” o Add Nasosoft Barcodes.dll to your project.

Add Barcode Windows Control to your Visual Studio Toolbox. o Open Toolbox in Visual Studio. Click menu View, and check submenu Toolbox. o Right click Toolbox, click menu Choose Items... o Go to .NET Framework Components tab.

o Click Browse... button and select Nasosoft Barcodes.dll file.

o Select the component BarcodeWinControl

Now you can see the component displayed on Toolbox. You can drag BarcodeWinControl on

your form,

Select the BarcodeWinControl on the windows form, and go to properties window to change barcode settings. For example, you can change the Code property to set barcode data

Set BarcodeType property to BarcodeType.Code93Standard or BarcodeType.Code93Extended

Page 81: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 77

Expand the BarcodeStyle property in the properties windows, you can now set the barcode style settings for the barcode image

How to Create Code 93 Barcode Image in .NET class?

Add Reference Nasosoft Barcodes.dll to your .NET project (ASP.NET website, Forms, any

.NET project) in your .NET class.

Create a Code93StandardBarcode instance.

Save the barcode to images using BarcodeImage class.

[VB.NET]

Dim b As Code93StandardBarcode = new Code93StandardBarcode ("123456789") Dim image As BarcodeImage = new BarcodeImage(b) image.Save("Code93Barcode.bmp")

[C#]

Code93StandardBarcode b = new Code93StandardBarcode("123456789"); BarcodeImage image = new BarcodeImage(b); image.Save("Code93Barcode.bmp");

How to Save Code 93 Barcode Image using .NET

Barcode Generator Windows Control?

Use BarcodeWinControl.Save function to save barcode into images.

Code93 Barcode Settings

Set the Type property to BarcodeType.Code93Standard or BarcodeType.Code93Extended.

Set the Code property with the value to encode.

Page 82: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 78

Code39 Barcode Style Settings

Set the WidthNarrowRatio property to change the default width bar and narrow bar ratio 3:1.

EAN13 Barcode

EAN13 Overview

EAN13 Barcode is a linear barcode, which is capable of encoding the full 128-character ASCII character set.

EAN13 Barcode is based upon the UPC-A standard, and is implemented by the International Article Numbering Association (EAN) in Europe.

EAN13 Barcode is well known as European Article Number 13, EAN-13 Supplement 5/Five-digit Add-On, EAN-13 Supplement 2/Two-digit Add-On, EAN-13+5, EAN-13+2, EAN13, EAN13+5, EAN13+2, UPC-13, GTIN-13, GS1-13, EAN/UCC-13.

EAN13 Barcode Structure

Number System: The number system consists of two digits (sometimes three digits)

which identify the country (or economic region) numbering authority which assigned

the manufacturer code. Manufacturer Code: The manufacturer code is a unique code assigned to each

manufacturer by the numbering authority indicated by the number system code. All products produced by a given company will use the same manufacturer code.

Product Code: The product code is a unique code assigned by the manufacturer.

Unlike the manufacturer code, which must be assigned by the UCC, the manufacturer

is free to assign product codes to each of their products without consulting any other

organization. Check Digit: The check digit is an additional digit used to verify that a bar code has

been scanned correctly.

Page 83: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 79

How to Create EAN13 Barcode through .NET Windows

Form Control in C# or VB.NET?

Add Reference Nasosoft Barcodes.dll to your project. o Right click the project and select the menu "Add Reference ...” o Add Nasosoft Barcodes.dll to your project.

Add Barcode Windows Control to your Visual Studio Toolbox. o Open Toolbox in Visual Studio. Click menu View, and check submenu Toolbox. o Right click Toolbox, click menu Choose Items... o Go to .NET Framework Components tab.

o Click Browse... button and select Nasosoft Barcodes.dll file.

o Select the component BarcodeWinControl

Now you can see the component displayed on Toolbox. You can drag BarcodeWinControl on

your form,

Select the BarcodeWinControl on the windows form, and go to properties window to change barcode settings. For example, you can change the Code property to set barcode data

Set BarcodeType property to BarcodeType.EAN13

Expand the BarcodeStyle property in the properties windows, you can now set the barcode

style settings for the barcode image

How to Create EAN13 Barcode Image in .NET class?

Add Reference Nasosoft Barcodes.dll to your .NET project (ASP.NET website, Forms, any

.NET project) in your .NET class.

Create an EAN13Barcode instance.

Save the barcode to images using BarcodeImage class.

[VB.NET]

Dim b As EAN13Barcode = new EAN13Barcode ("123456789012") Dim image As BarcodeImage = new BarcodeImage(b) image.Save("EAN13Barcode.bmp")

Page 84: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 80

[C#]

EAN13StandardBarcode b = new EAN13StandardBarcode("123456789012"); BarcodeImage image = new BarcodeImage(b); image.Save("EAN13Barcode.bmp");

How to Save EAN13 Barcode Image using .NET

Barcode Generator Windows Control?

Use BarcodeWinControl.Save function to save barcode into images.

EAN13 Barcode Settings

Set the Type property to BarcodeType.EAN13.

Set the Code property with the value to encode. The number of characters of Code property must be 12. Check digits of the barcode is calculated by the component automatically.

Page 85: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 81

FAQ

For more information about Nasosoft Barcodes for .NET, please visit www.nasosoft.com.

Page 86: Nasosoft Barcode for - ComponentSource... i Working with BarcodeWinControl Classes..... 33 Barcodes in SQL Server Reporting Services 48 Add Barcode to Your

www.nasosoft.com 82

Resources

For more information about Nasosoft Barcodes for .NET, please visit www.nasosoft.com.