Spire.Barcode is a professional barcode library specially designed for .NET developers (C#, VB.NET, ASP.NET, .NET Core) and Java developers (J2SE and J2EE) to generate, read and scan 1D & 2D barcodes.

Wed Jan 03, 2018 5:45 am

Hi,
We are trying to fit in barcode that is generated using 30 characters input in a label of size 57mm x 32mm(width x height). Is there any possibility to set fixed Height & Width for a barcode without losing the data(readability). We are using code 128 symbology and our input string length to generate barcode is 30 characters.

curvaturepdfapi
 
Posts: 32
Joined: Wed Apr 20, 2016 10:08 pm

Wed Jan 03, 2018 8:20 am

Hello,

Thanks for your inquiry. Please refer to the below code snippet to set barcode height. Spire.Barcode doesn’t support setting barcode width at present, we will consider adding it in our future upgrade. If there is any update, we will let you know.
Code: Select all
BarcodeSettings bs = new BarcodeSettings();
bs.BarHeight = 20f;


Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Thu Jan 04, 2018 12:41 pm

Hello,
Thanks for your reply.... Actually we are looking if we can set custom width or not. Code block that has been provided does not suite our requirement. Anyways thanks again for quick response.

curvaturepdfapi
 
Posts: 32
Joined: Wed Apr 20, 2016 10:08 pm

Fri Jan 05, 2018 2:19 am

Hello,

Thanks for your reply. Once the new function is available, we will inform you.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Fri Jan 05, 2018 3:34 am

Hello,

With further investigation, I find the solution to adjust the width and height of the barcode image. Please refer to the below code snippet.
Code: Select all
            BarcodeSettings settings = new BarcodeSettings();
            settings.Type = BarCodeType.Code128;

            settings.ShowText = true;
            Font myFont = new Font("Verdana",9);
            settings.TextFont = myFont;

            string data = "11S47J0151Y1Q0MS0CS03T1";
            settings.Data = data;
            settings.Data2D = data;
            settings.Code128SetMode = Code128SetMode.Auto;         

            //change the unit in order to adjust the scaling
            settings.Unit = GraphicsUnit.Pixel;

            //set auto resize to false
            settings.AutoResize = false;
            //set barcode width
            settings.X = 0.6f; 
            //set barcdoe barcode height
            settings.BarHeight = 150;

            settings.ImageWidth = 300;
            settings.ImageHeight = 200;
           
            BarCodeGenerator generator = new BarCodeGenerator(settings);
            var image = generator.GenerateImage();


Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Mon Jan 08, 2018 5:24 am

Hello,
Is Spire.Barcode paid vesrion or do we have free version as well? We tried with the logic you have provided but we are getting evaluation message on top of barcode.

curvaturepdfapi
 
Posts: 32
Joined: Wed Apr 20, 2016 10:08 pm

Mon Jan 08, 2018 7:22 am

Hello,

Thanks for your inquiry. Please download the free version from below link. There is no evaluation message instead of "E-ICEBLUE" in the top. If it can't fulfill your requirements, you need to use the commercial version with a license.
https://www.e-iceblue.com/Download/down ... t-now.html

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Mon Jan 08, 2018 7:26 am

Hello,
Thanks for the update

curvaturepdfapi
 
Posts: 32
Joined: Wed Apr 20, 2016 10:08 pm

Return to Spire.BarCode

cron