Ticket T1279894
Visible to All Users

ASP.NET BarCode 128

created 3 days ago

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

Code
private 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;![Clipboard-File-1.png](/attachment/file/b771cefe-5eac-4db9-88fe-fca33ec0fb19) 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)); }
Comments (1)
Sasha (DevExpress Support) 2 days ago

    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:

    C#
    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:

    C#
    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.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.