Create QR Code
IronBarcode offers developers intuitive and easy-to-use methods to create unique QR codes with a plethora of customizations. Whether you are a developer looking for a simple QR code generator with a few lines of code or a more complex generator where you can control all aspects of the QR code, such as the correction level, size, and version, IronBarcode offers everything you need in one library.
// Import the necessary library for QR code generation
using IronBarCode;
// Create a simple QR code with a URL
GeneratedBarcode qrCode = QRCodeWriter.CreateQrCode("https://ironsoftware.com/");
// Set the error correction level to the highest for better error tolerance
var correction = QRCodeWriter.QrErrorCorrectionLevel.Highest;
// Define the size of the QR code in pixels
int size = 500;
// Define the version of the QR code
// Version ranges from 1 to 40. Larger versions can store more data.
int qrVersion = 0;
// Create a more complex QR code with specified size, correction level, and version
string value = "https://ironsoftware.com/";
GeneratedBarcode qrCodeComplex = QRCodeWriter.CreateQrCode(value, size, correction, qrVersion);
// Import the necessary library for QR code generation
using IronBarCode;
// Create a simple QR code with a URL
GeneratedBarcode qrCode = QRCodeWriter.CreateQrCode("https://ironsoftware.com/");
// Set the error correction level to the highest for better error tolerance
var correction = QRCodeWriter.QrErrorCorrectionLevel.Highest;
// Define the size of the QR code in pixels
int size = 500;
// Define the version of the QR code
// Version ranges from 1 to 40. Larger versions can store more data.
int qrVersion = 0;
// Create a more complex QR code with specified size, correction level, and version
string value = "https://ironsoftware.com/";
GeneratedBarcode qrCodeComplex = QRCodeWriter.CreateQrCode(value, size, correction, qrVersion);
' Import the necessary library for QR code generation
Imports IronBarCode
' Create a simple QR code with a URL
Private qrCode As GeneratedBarcode = QRCodeWriter.CreateQrCode("https://ironsoftware.com/")
' Set the error correction level to the highest for better error tolerance
Private correction = QRCodeWriter.QrErrorCorrectionLevel.Highest
' Define the size of the QR code in pixels
Private size As Integer = 500
' Define the version of the QR code
' Version ranges from 1 to 40. Larger versions can store more data.
Private qrVersion As Integer = 0
' Create a more complex QR code with specified size, correction level, and version
Private value As String = "https://ironsoftware.com/"
Private qrCodeComplex As GeneratedBarcode = QRCodeWriter.CreateQrCode(value, size, correction, qrVersion)
After importing the IronBarcode library, we first instantiate the QRCodeWriter
class and then use QRCodeWriter.CreateQrCode
to create a new QR code with a string value of a URL. This method is the simplest way to create a QR code with default settings.
We can adjust the QR code's error correction level for more customization. This level correlates to the amount of redundancy or error recovery data included in the QR code, making it more fault-tolerant and ensuring it works under harsh conditions.
To control the size
, simply assign an integer value to it. The qrVersion
(between 1 and 40) represents the QR code version. Depending on how much data you wish to store and the capacity you want the QR code to have, developers can fine-tune it to balance between capacity and size to ensure optimization. For more information on how to determine the version of your QR code, please refer to this documentation here.
Finally, we pass all our established variables, size
, qrVersion
, and correction
, to the QRCodeWriter.CreateQrCode
method again to generate a customized QR code with all the attributes listed above.
Click here to view the How-to-Guide, including examples, sample code and files