I am generating IDAutomationHC39M barcode but after generating and on scanning I am not getting the any of the value.
My code is
public void generateBarcode(int id)
{
if (plBarCode != null)
{
string barCode = "";
barCode = "*"+Convert.ToString(id)+"*";
System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
using (Bitmap bitMap = new Bitmap(barCode.Length * 70, 70))
{
using (Graphics graphics = Graphics.FromImage(bitMap))
{
Font oFont = new Font("IDAutomationHC39M", 30);
PointF point = new PointF(2f, 2f);
SolidBrush blackBrush = new SolidBrush(Color.Black);
SolidBrush whiteBrush = new SolidBrush(Color.White);
graphics.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height);
int w = barCode.Length * 40;
Graphics oGraphics = Graphics.FromImage(bitMap);
PointF oPoint = new PointF(2f, 2f);
SolidBrush oBrushWrite = new SolidBrush(Color.Black);
SolidBrush oBrush = new SolidBrush(Color.White);
oGraphics.FillRectangle(oBrush, 0, 0, w, 100);
oGraphics.DrawString("*" + barCode + "*", oFont, oBrushWrite, oPoint);
}
using (MemoryStream ms = new MemoryStream())
{
bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
byte[] byteImage = ms.ToArray();
Convert.ToBase64String(byteImage);
imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
}
plBarCode.Controls.Add(imgBarCode);
}
}
}
what is the wrong on this code.
How should I generate my code any help?
Here is the top 5 Reasons Why a Barcode Font Won't Scan ...
http://idautomation.blogspot.in/2011/07/top-5-reasons-why-barcode-font-wont.html
If you are attempting to encode a small amount of characters, it may be a good idea to be sure that your scanner is capable of scanning the minimum amount, as many are set to read a minimum of 4 characters in a barcode. On the other hand, if there are too many characters being encoded in a barcode, then it will be too large and will not scan properly. Decreasing the font size and re-scanning may solve this issue.