Hi!
I am attempting to generate a barcode 128. If I leave barCode.AutoSize = true;
the barcode works great. I can successfully scan it.
However if I set barCode.AutoSize = false;
then the bar code image comes across as shown in the attached image. This cannot be scanned. How can I change the barcode height and width to generate a barcode I can use?
Thank you.,
jacks@dlcoffee.com
Codeprivate void BarCode_Test1(PdfGraphics graph, string CodeText, int xAxis, int yAxis, int Width, int Height)
{
BarCode barCode = new BarCode();
barCode.Symbology = Symbology.Code128;
barCode.Options.Code128.Charset = Code128CharacterSet.CharsetB;
barCode.Options.Code128.ShowCodeText = true;
barCode.CodeText = CodeText; // Example: "JOB109379";
barCode.BackColor = System.Drawing.Color.White;
barCode.ForeColor = System.Drawing.Color.Black;
barCode.RotationAngle = 0;
barCode.DpiX = 72;
barCode.DpiY = 72;
barCode.AutoSize = false;
barCode.ImageWidth = Width;
barCode.ImageHeight = Convert.ToInt32(Width * .333); // Height;
barCode.Module = 1f;
graph.DrawImage(barCode.BarCodeImage, new PointF(xAxis-200, yAxis));
}
Hello Jack,
Thank you for the code snippet. I reviewed it but didn't find an obvious reason for the issue. If I understand correctly, you are adding the generated BarCodeImage to a PDF file:
graph.DrawImage(barCode.BarCodeImage, new PointF(xAxis-200, yAxis));
If so, would you please ensure that you use correct DPI when you are calling the AddToPageForeground method:
graph.AddToPageForeground(page, 72, 72);
If it doesn't help, please modify the attached project to illustrate the issue or share your own project where the issue is reproducible.
I look forward to your results.