Skip to content

Commit 779dc46

Browse files
committed
kb(barcode): set a logo in the center of the QR
1 parent 497759a commit 779dc46

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: How to apply a Custom Logo to the RadBarcode QR Code
3+
description: Learn how to add an icon to the RadBarcode QRCode type - Telerik UI for ASP.NET AJAX
4+
type: troubleshooting
5+
page_title: Add a small image to the QR code
6+
slug: barcode-set-qr-icon
7+
position:
8+
tags:
9+
ticketid:
10+
res_type: kb
11+
---
12+
13+
## Environment
14+
<table>
15+
<tbody>
16+
<tr>
17+
<td>Product</td>
18+
<td>RadBarcode for ASP.NET AJAX</td>
19+
</tr>
20+
</tbody>
21+
</table>
22+
23+
24+
## Description
25+
If you are curious to learn how to position an icon in the center of the Telerik RadBarcode check out the solution below:
26+
27+
## Solution
28+
To position an icon in the center of the Telerik RadBarcode for ASP.NET AJAX control, you need to overlay the icon on top of the barcode using CSS positioning. Here's a step-by-step guide to achieve this:
29+
30+
1. Position the icon right after or before the RadBarcode control inside a container (like a div):
31+
````ASPX
32+
<div class="barcode-container">
33+
<telerik:RadBarcode runat="server" ID="RadBarcode1" Type="QRCode" Text="https://demos.telerik.com/aspnet-ajax/barcode/examples/overview/defaultcs.aspx" Width="150" Height="150"></telerik:RadBarcode>
34+
<img src="https://demos.telerik.com/kendo-ui/content/shared/images/site/kendoka-cta.svg" class="centered-icon" />
35+
</div>
36+
````
37+
38+
1. CSS for Centering the Icon: Use absolute positioning to center the icon on top of the barcode. The .barcode-container will have relative positioning to act as a reference point for the absolute positioning of the icon:
39+
40+
````CSS
41+
<style>
42+
.barcode-container {
43+
position: relative;
44+
width: 150px; /* Same as barcode width */
45+
height: 150px; /* Same as barcode height */
46+
}
47+
.centered-icon {
48+
position: absolute;
49+
top: 50%;
50+
left: 50%;
51+
transform: translate(-50%, -50%);
52+
width: 24px; /* Adjust as per your needs */
53+
height: 24px; /* Adjust as per your needs */
54+
}
55+
</style>
56+
````
57+
58+
> Ensure Icon Visibility: If your barcode type is dense (like QR codes), make sure your icon has a transparent background and is easily distinguishable from the barcode itself. Additionally, keep in mind that placing an icon over the barcode might make it unreadable if it covers too many data portions of the barcode. If you're planning to scan the barcode, always test its readability after applying the overlay.
59+
60+

0 commit comments

Comments
 (0)