Using GDI+ to Draw Barcodes
page 1 of 5
Published: 24 Aug 2005
Unedited - Community Contributed
Abstract
Barcode components for .NET can be very expensive. Would you like a free alternative? Terry Voss provides a simple and extensible barcode solution that creates barcode graphics using only the .NET Framework.
by Terry Voss
Feedback
Average Rating: 
Views (Total / Last 10 Days): 22904/ 60

Introduction

This article provides a barcode solution that does not use any components, controls, or fonts. The barcodes are drawn with code using the classes of the System.Drawing namespace, which exposes the GDI+ subsystem of Windows. The solution shows how to create and display Code39 and UPC-A barcodes on an ASP.NET web page. The code is simple to extend to support other barcode formats, once you have found the defining characteristics of the barcode format. Ease of testing, debugging, and feature change will be shown to be attributes of this solution.


View Entire Article

User Comments

Title: 123   
Name: 123
Date: 2013-01-15 8:33:43 AM
Comment:
123
Title: linear barcode   
Name: andbar
Date: 2012-05-28 3:54:45 AM
Comment:
linear barcode generator:
http://www.keepdynamic.com/1D-2D/linear-barcode-generator-net.shtml
Title: Thanks, good article   
Name: Richard
Date: 2008-09-07 11:36:44 PM
Comment:
Thanks, good article
Title: is it possible   
Name: Lanumin
Date: 2008-03-10 8:50:16 AM
Comment:
Is there a way to have a working barcode tatoo?
Title: upc converted to private product code   
Name: davidp.
Date: 2007-07-20 1:50:27 PM
Comment:
I have a question. How can i scan a upc barcode and use that for my 5 digit company item number on a barcode? Ok when we receive items in we make our own labels for these items without using their upc codes that are already on these items. we have a description of the item on file and it is converted to our 5 digit barcode for inventory control.
Title: Everything is good now...!   
Name: Isidore
Date: 2007-06-27 2:29:58 PM
Comment:
Hello,

I called the scanner manufacturers an they told me that some parts of the the barcode were not printed. I increased the size of the image to allow for no cutting of letters. It worked perfectly.

This is only possible with Code39 though as I realized from the article you referenced that UPC-A supports digits...(not verified)

I have printed all the characters in any length now using code39 and they all scanned well.

Thanks for the free code once again.

Isidore.
Title: Letters not printing   
Name: Terry Voss
Date: 2007-06-27 12:04:49 PM
Comment:
Place a breakpoint on the line of code:
if _text = 1 then and use F11 to trace through the code for creating the print of the letters to see why it is not printing.
Title: UPC Code for letters (a,b,c...) printed 0000000000   
Name: Isidore
Date: 2007-06-27 7:56:10 AM
Comment:
Hello,

Thanks for the code. I recently tested the barcodes with a scanner and the upc worked fine. However, the letters did not print. They generated 0's.

Is there anything that could be done about this. Urgent response will be highly appreciated.
Title: Thanks   
Name: Isidore
Date: 2007-06-14 11:37:32 AM
Comment:
Thanks for your advice. I added a button to the barcode.aspx page to raise the event placed on the page load event handler. This way I was able to confirm that the code is valid. I will figure out how to place the barcodes on pages of production control documents to be used by scanners.

Using a scanner to read these barcodes is the ultimate feature of the system I am building. If you have any help in this regard...I will appreciate it a lot.

Thanks for your prompt response though.
Title: bcode.barcode not found   
Name: Terry Voss
Date: 2007-06-13 12:18:04 PM
Comment:
you see there is a public class barcode defined in one of the 4 source files, right? So the culprit is the bcode part which is: a namespace default for the vb asp.net project of the name bcode. So you need to name your project bcode, or change the namespace part of the object instance specification: bcode.barcode to myprojectname.barcode.
Title: Unable to run code on asp.net 2.0 VS 2005   
Name: Isidore
Date: 2007-06-12 6:35:23 PM
Comment:
Hello,

I appreciate your solution...However, I tried running the code on VS 2005 (asp.net 2.0) and here is the error message:
"Could not load type 'bcode.barcode'"

I tried removing bcode but it still did not work. Urgent response will be highy appreciated as I see that most of your fans really like the code and it seems to be working for them.
Title: Equivalent for C#   
Name: pedro
Date: 2006-10-24 8:22:27 PM
Comment:
First of all, I want to thank you for this code.
Second, I want to know if anyone has already tried to convert sucessfully this code to C#?

Thanks in advance,

pedro
Title: Barcode   
Name: Amit
Date: 2006-10-17 9:24:46 AM
Comment:
this is really nice concept to gererate barcode..
Title: Code 128   
Name: Ketan
Date: 2006-04-17 1:52:17 AM
Comment:
Hello, can someone say what configurations are required to print Code 128 barcode.
Title: not printing the last *   
Name: Roel
Date: 2005-11-04 5:06:49 AM
Comment:
Hi,
I'm having the following problem. I tried the code as found in the zipfile, but the last * is not printed correct in the barcode. All the other numbers and * are printed correct.

Can somebody give me some advice ??

Thx !
Title: somequestion   
Name: tarek
Date: 2005-11-02 9:03:44 AM
Comment:
i am very greatful to reply i working on visual c++6 and
i tried to make a barcode by using visual c++6 by using PrintBarcode and some function but i have a failer to do this ..can you help me and send for me complete example to create a barcode for any type
thank you for your helping
tarek taha
system analyst
ministory of heath
saudia arabia
tarek13051971@yahoo.com
Title: great   
Name: Qqczka
Date: 2005-09-13 5:33:54 PM
Comment:
Works great on VB.NET Windows.Forms... with some changes (http://www.qqczka.prv.pl/testBarCode.zip).
Somebody know another algorithm for EAN-128 ???
Like C-39 in this article:
Case "9" : clet = "1011100010111010"
Case "0" : clet = "1010001110111010"
Case "A" : clet = "1110101000101110"

Lukas (Poland)
Title: Thanks   
Name: T
Date: 2005-09-10 5:10:02 PM
Comment:
Thanks for this solution. It's an outstanding alternative to using those components and installing fonts on the server.

Keep it up!

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2020 ASPAlliance.com  |  Page Processed at 2020-09-25 11:10:40 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search