This is a migrated thread and some comments may be shown as answers.

QR Barcode Image Size

5 Answers 464 Views
Barcode
This is a migrated thread and some comments may be shown as answers.
Alejandro Genovesi
Top achievements
Rank 2
Alejandro Genovesi asked on 07 Sep 2018, 09:54 PM

It is possible to set the height and width of the QR Code in pixels?. Already set de DotSize in 0, but the result image always has 53x53px.

 

 

5 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 10 Sep 2018, 12:08 PM
Hello,

If you want to have the barcode size to its container you need to set DotSize to 0: https://docs.telerik.com/devtools/aspnet-ajax/controls/barcode/qrcode.

<telerik:RadBarcode runat="server" ID="RadBarcode1"
    Type="QRCode" Height="140px" Width="140px"
    <QRCodeSettings Version="5" DotSize="0" Mode="Byte" />
</telerik:RadBarcode>
 
<telerik:RadBarcode runat="server" ID="RadBarcode2"
    Type="QRCode" Height="340px" Width="340px"
    <QRCodeSettings Version="5" DotSize="0" Mode="Byte" />
</telerik:RadBarcode>


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Alejandro Genovesi
Top achievements
Rank 2
answered on 10 Sep 2018, 02:42 PM

Thanks Marin, here is my code:

 

 <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
        </telerik:RadScriptManager>
    

     <telerik:RadTextBox RenderMode="Lightweight" ID="RadTextBoxURL" LabelWidth="40px" Width="400px" runat="server"
                        Label="URL: " Text="www.google.com" />
         <telerik:RadButton RenderMode="Lightweight" ID="Button1" runat="server" Text="Generate" OnClick="Button1_Click" />
        <telerik:RadBarcode runat="server" ID="barcode" Type="QRCode" OutputType="EmbeddedPNG"
                >
                <QRCodeSettings Version="5" DotSize="0" Mode="Byte" />
            </telerik:RadBarcode>
        <telerik:RadTextBox ID="txtTamano" runat="server" Label="Tamaño"></telerik:RadTextBox>
        <telerik:RadTextBox ID="txtDotSize" runat="server" Label="DotSize"></telerik:RadTextBox>

 

 

protected void Button1_Click(object sender, EventArgs e)
        {
            //barcode.BorderWidth = 0;
            barcode.QRCodeSettings.DotSize = Convert.ToInt16(txtDotSize.Text);
            barcode.Height = Convert.ToInt16(txtTamano.Text);
            barcode.Width = Convert.ToInt16(txtTamano.Text);
            barcode.Text = RadTextBoxURL.Text;

            Bitmap bitmap1 = new Bitmap(barcode.GetImage());
            bitmap1.Save("C:\\inetpub\\wwwroot\\cache\\ale.png", System.Drawing.Imaging.ImageFormat.Png);
            
            //string sArc = "C:\\inetpub\\wwwroot\\cache\\ale.png";
            //barcode.GetImage().Save(sArc);

        }

The image always has 45x45 px as you can see in th attached file.

Is the version related with de heigth and width? with AutoIncreaseVersion="true" the image always has 53x53px

 

Alejandro

 

 

0
Alejandro Genovesi
Top achievements
Rank 2
answered on 10 Sep 2018, 02:51 PM
Sorry, forgot the image
0
Alejandro Genovesi
Top achievements
Rank 2
answered on 10 Sep 2018, 02:57 PM
Sorry forgot the image
0
Marin Bratanov
Telerik team
answered on 10 Sep 2018, 10:30 PM
Hi Alejandro,

I added explanations on how this works in the documentation, and they will be live with our next upload. You can preview them here: https://github.com/telerik/ajax-docs/blob/master/controls/barcode/qrcode.md#how-to-control-the-size-of-the-qr-code. I hope this explains how the control works.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Barcode
Asked by
Alejandro Genovesi
Top achievements
Rank 2
Answers by
Marin Bratanov
Telerik team
Alejandro Genovesi
Top achievements
Rank 2
Share this question
or