|
I don't. However, codeproject seems to. check out
http://www.codeproject.com/cs/media/GenCode128.asp
|
|
|
|
|
Hi Kumar
Do generate Bar code, At very first we need to add reference..."barcodelib"
And rest of the code goes like this (To generate and print)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.PointOfService;
using System.IO;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Image = null;
BarcodeLib.Barcode b = new BarcodeLib.Barcode(textBox1.Text);
b.EncodedType = BarcodeLib.TYPE.CODE39;
Image barcode = b.Encode();
pictureBox1.Image = barcode;
label1.Text = b.RawData;
barcode.Save("C:\\Barcode.jpg");
//System.Drawing.Imaging.EncoderParameters encodeParams= new System.Drawing.Imaging.EncoderParameters();
//encodeParams.Param[0] = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.ScanMethod, textBox1.Text);
//printDialog1.ShowDialog();
// printDialog1.PrinterSettings.PrinterName="HP LaserJet P2015 Series PCL 5e";
// printDialog1.AllowSomePages = true;
// System.Drawing.Printing.PrintDocument doctoPrint = new System.Drawing.Printing.PrintDocument();
//printDialog1.Document = doctoPrint;
//doctoPrint.Print();
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
System.Drawing.Font printFont = new System.Drawing.Font
("Arial", 35, System.Drawing.FontStyle.Regular);
// Draw the content.
e.Graphics.DrawString("Hi", printFont, System.Drawing.Brushes.Black, 10, 10);
}
}
}
If u have idea about how to interface digital camera to our windows application...plz revert back
Regards
Kiran
|
|
|
|
|
I justed wanted to let you know that I have successfully implemented this library and I have found that increasing the num of scans of the image greatly increases the success rate of finding a valid barcode. I also added a checksum function that makes certain that the code is valid.
Thanks,
Curtis
|
|
|
|
|
Could you post your improved source and demo here so everyone will benefit?
Thanks
We can't stop asking "WHY!!"
|
|
|
|
|
I increased the number of scans that it did while doing a full path scan and I also added my own function in VB.net to check for the check sum digit. I have control of the barcode printing so I know that my barcodes use a check digit for accuracy.
Code:
ImgBar.FullScanPageCode39(AryCodes, bmpPage, 200)
#Region "CheckSum Code"
Public Function CheckSum(ByVal Code As String) As Boolean
Dim I As Integer
Dim sum As Integer
Dim SingleChar As String
Dim ChkVal As Integer
Dim ModChk As Integer
Dim CodeEnd As Integer
CodeEnd = Code.Length - 2
If CodeEnd > 0 Then
For I = 0 To Code.Length - 2
SingleChar = Nothing
ChkVal = 0
SingleChar = Code.Chars(I).ToString
'Get the value of the character
ChkVal = CheckValAry(SingleChar)
sum += ChkVal
Next
'Get the last character
Dim CheckChar As String
Dim TrailingChkVal As Integer
'Get the last character of the barcode text
CheckChar = Code.Chars(Code.Length - 1)
TrailingChkVal = CheckValAry(CheckChar)
'The mod of the sum should equal the value of the check sum character
ModChk = sum Mod 43
If ModChk = TrailingChkVal Then
Return True
Else
Return False
End If
Else
Return False
End If
End Function
Public Function CheckValAry(ByVal pChar As Char) As Integer
pChar = UCase(pChar)
Dim AryChar() As Char = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "-", ".", " ", "$", "/", "+", "%"}
Return AryChar.IndexOf(AryChar, pChar)
End Function
#End Region
|
|
|
|
|
How tolerant is the scanner of angled rotations?
|
|
|
|
|
It appears that it is not very tolerant the barcodes being at an angle, does anyone have any suggestions as to how to improve this library to correct that?
Thanks,
Curtis
|
|
|
|
|
I'm trying to read the barcode using my barcodereader, but nothing happens. My reader makes an bib, so I guess it manage to read the code, but I would really like that to make the messagebox popup showing my barcode converted to alphanumeric...
Anyone know how to do that?
Thanks, Ole
|
|
|
|
|
Yes, use the FullScanPageCode39 method and it will pass you back an array list of values that it found. You can look through that arrylist and display it back to the user in a messagebox if you like.
Curtis
|
|
|
|
|
This code isn't realy intended for use with a barcode reader, and I'm really not sure if they are in any way compatable, as I don't have a reader to play with.
This topic was intended for finding barcodes in images, such as scanned pages.
Sorry that I can't be more helpful.
|
|
|
|
|
Yeah, this code is pretty much completely intolerant of angles, as it's meant for scanned documents... and if someone's scanning documents diagonally, they should be beaten severely.
I think that an angled reader would be a great deal more difficult to build, however if the number of scans were increased dramaticly (well above 50) then at least one of the scans should read a barcode as long as the angle isn't severe enough that no scan gets across the whole barcode.
Barcode scanners in Supermarkets have dozens of scan lines at differant angles to accomplish this.
|
|
|
|
|
I just want to know in barcode is usually start by * and end by * ... so can we aim in ArrayList if found string start with * and * is a content ?
|
|
|
|
|
In my experience, most barcodes begin and end with *
However, I have also seen a model with a fixed number of characters, which is more difficult to parse out.
Also remember that there may be text on the same scan line as your barcode, so your result in the arraylist may be something like:
kjh4#u*SURPRISE*fvj
Still, it's pretty easy to parse out useful text from this.
|
|
|
|
|
Here in codeproject is the code for deskewing an image.
Search for "deskew" and have a look for that code.
But deskewing takes a while in larger images. It makes sense to crop zones to shorten the process.
|
|
|
|
|
I'm doing some work in the area of reading barcodes off a webcam. It will tolerate barcodes at any angle.
heres a screenshot of the inital work showing detection of barcode portion of an image.
http://i44.photobucket.com/albums/f29/Section8NZ/barcodes.png[^]
I'll be releasing this as open source when its ready.
|
|
|
|
|
|
Its a lot more difficult than it looks.
Ive got the code working to track the barcode at any angle, but now I'm running into trouble with a slight fish-eye distortion from the webcam being up close.
check out the latest version http://i44.photobucket.com/albums/f29/Section8NZ/BarcodeScanner.png
Despite the left and right guard bars being scaled correctly, the center of the image is way out.
|
|
|
|
|
Maybe you could use one time calibration for the webcam. You can show a pattern of squares printed on a paper to the cam and since you now the original undistorted image, maybe you can calculate where and how much the distortion occurs and correct it. Just a thought
|
|
|
|
|