We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Setting size on barcode (Symbology.QR)

hi there,

I’m trying to set size on QR barcode. I only want the barcode, so I have done this:
BarCodeBuilder builder = new BarCodeBuilder(barcodeText, Symbology.QR);
builder.GraphicsUnit = GraphicsUnit.Millimeter;
builder.AutoSize = false;

then I have tried a number of settings involving:
builder.xDimension = 1f;
builder.yDimension = 4f;
builder.ImageWidth = 50f;
builder.ImageHeight = 50f;

I have tried using the “save” function on the builder, builder.barcodeimage, builder.GetCustomSizeBarCodeImage

And somehow I can not set the barcode-size correctly.
I would like to achieve setting one barcode fx. to 6 millimeters (height) and another one to 20 millimeters. Or what ever the user set it to.

Please help I am going mad :slight_smile:

Hi Christain,

Thank you for contacting support. Aspose.BarCode provides control over the barcode image size. Please refer to this helping topic: Generate Barcode Using Custom Width Support

The getOnlyBarCodeImage method will allow you to get the exact bar code in the form of buffered image and then the getCustomSizeBarCodeImage method will allow you to set the size of the whole picture with bar code inside. Please don't truncate its original width or height otherwise you could face recognition failure problems.

Please feel free to reply us in case of any confusion or questions.