Barcode Size

Technical support for Spire.BarCode.

Moderator: iceblue support

Barcode Size

Postby cath » Mon Mar 17, 2014 8:10 am


Im using the code128. The size of the barcode always changes according to the input of the text. Can we fixed the width of the barcode even though the input is long?

Besides that, how do you change the height and width? My barcode labels are not as big as the demo shown.

Appreciate if you could reply.

Thank you.

Posts: 6
Joined: Thu Nov 21, 2013 4:15 am

Re: Barcode Size

Postby Benjamin Du » Mon Mar 17, 2014 8:53 am


Sorry. Spire.Barcode doesn’t support setting fixed width at present. To set the height of barcode, please refer to the following code:
Code: Select all
BarcodeSettings barsetting = new BarcodeSettings();
barsetting.X = 0.8f;
barsetting.Unit = GraphicsUnit.Millimeter;

//set the width of barcode
barsetting.BarHeight = 25;

barsetting.HasBorder = true;
barsetting.BorderWidth = 0.5F;

barsetting.Data = "545863";
barsetting.Data2D = "545863";
//generate EAN-Code 128
barsetting.Type = BarCodeType.EAN128;

BarCodeGenerator bargenerator = new BarCodeGenerator(barsetting);
Image barcodeimage = bargenerator.GenerateImage();


If there are any questions, welcome to tell us.

E-iceblue support team
User avatar
Benjamin Du
Posts: 83
Joined: Thu Jul 25, 2013 2:38 am

Re: Barcode Size

Postby amy.zhao » Thu Apr 20, 2017 9:30 am


Thanks for patience waiting.
Our Spire.Barcode has supported setting fixed width. Welcome to download new version( ... r-net.html) and test the below code.
Code: Select all
barsetting.Unit = GraphicsUnit.Pixel;
barsetting.ImageWidth = 200f;
barsetting.AutoResize = false;

E-iceblue support team
User avatar
Posts: 2251
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.BarCode

Who is online

Users browsing this forum: No registered users and 0 guests