Reputation: 2593
I've been looking for solutions and so far the best one I think for my project is to use a free Code 39 font. However, I've tried printing some samples and my barcode scanners can't read them.
I researched a bit more and stumbled upon this.
I printed Code 39 barcodes using that library and it worked just fine, the scanners are able to read them.
Problem is, the library is written in C# but not for ASP.net. I've tried playing around with the code but it's too complex for my basic knowledge. There are a lot of functions included in that library code and has a lot of other barcode types, making it harder for me to analyze.
Are there other ways to generate a Code 39 barcode? The library in codeproject seems a little to complex for my requirements.
Upvotes: 5
Views: 9286
Reputation: 371
Barcode scanners require your code 39 barcodes to be prefixed and suffixed with asterisks to read. Example: *12345*
Upvotes: 7
Reputation: 27369
First off, you say the library isn't written for ASP.NET, but if you can produce images with it then the easiest thing to do is write an HttpHandler
that sits overtop of the library and returns the generated images to the browser. If it's a .NET library, I don't see any reason why that shouldn't work.
That being said, there are a couple things to look out for when generating Code39 barcodes:
*
)?For #1, I would check to make sure the images you are printing from your Code39 font look the same as the ones from the library. If they are, then image quality is probably the issue.
As far as #2 goes, I've successfully used a free Code 39 font with GDI+ to generate barcode images that I then displayed in HTML pages for printing. One of the problems I ran into when trying to scan the printed barcode images was that the images were not sharp enough (the edges of the barcode lines were blurry) and were not able to be read by the scanners.
The way I got around low quality images was to generate a large Code39 barcode image (say 1000 x 400), and then on the <img>
tag that was displaying that barcode, I would set the width to something much smaller, say (200px, or 2.0 in). I would be sure to set only the width, the height will scale proportionally with the image. That would effectively increase the DPI of the image when it is printed, allowing us to produce barcode images that are easily able to be scanned (especially if you are printing using a laser printer).
EDIT
Almost forgot, one other good practice to use when generating these barcodes is to always print what you are barcoding underneath the barcode image. That's your failsafe in case the barcode image will not scan for whatever reason. You can see an example of this if you look at any standard UPC symbol. The numbers at the bottom are exactly what the barcode will read when it is scanned.
Upvotes: 2