Set width and height of QR code

How to set width and height of QR Code image to 100px X 100px

Hi,


Thank you for inquiry.

Please refer to http://www.aspose.com/documentation/.net-components/aspose.barcode-for-.net/print-barcode-of-exact-size-based-on-unit.html for generating barcodes of exact size.

However, the size of image depends upon the size of codetext and some other factors. For more information please visit http://www.aspose.com/documentation/.net-components/aspose.barcode-for-.net/adjusting-2d-images-size.html and http://www.aspose.com/documentation/.net-components/aspose.barcode-for-.net/manage-xdimension-and-ydimension.html.

Can you give me sample code for controlling width and height of QR code (2D barcode) with margin zero from all side.

Hi,


Please see the code below:

private static Bitmap GetBarcodeImage(string code, float height, float width)
{
BarCodeBuilder builder = new BarCodeBuilder(code, Symbology.QR);
builder.GraphicsUnit = GraphicsUnit.Pixel;
builder.Margins.Bottom = 0;
builder.Margins.Right = 0;
builder.Margins.Top = 0;
builder.Margins.Left = 0;
builder.BorderVisible = false;
builder.BorderWidth = 0;
builder.CodeLocation = CodeLocation.None;
builder.AutoSize = false;
builder.ImageHeight = height;
builder.BarHeight = height-1;
builder.xDimension = 0.6f;

return builder.BarCodeImage;
}