preamble
In the daily development needs , generate QR codes to share text content or jump to a specified website link and other scenes are more common . NET open source (MIT License), free, easy to use, powerful QR code generation library : QrCodeGenerator.
Project Characteristics
- Cross-platform compatibility: NET Standard 2.0 and higher is supported, so it runs on most modern .NET platforms, including .NET Core, .NET Framework, Mono, etc., as well as .NET 6 on all platforms.
- Rich output formats: A variety of output formats are provided, including raw modules/pixels of QR symbols, SVG and XAML paths, BMP bitmaps, and more.
- Efficient text encoding: Encoding numeric and special alphanumeric text takes up less space than normal text.
- Flexible parameter settings: Allows developers to specify parameters such as mask mode, error correction level, and data segment list, providing a high degree of flexibility and customization.
- Abundant use of sample code: Project source code provides in WinForms, WPF, WinUI, Core and other environments to use the sample code .
Image Generation Extension
From .NET 6 onwards, only Windows operating systems are supported, which is not compatible with cross-platform. ThereforeToBitmap()
has been removed and now provides three options in the form of method extensions.
Select one of the image libraries below, add the NuGet dependencies to the project, and copy the corresponding files to the project.
Quick use in console applications
Creating a Console Application
Creates a file named:QrCodeGeneratorExercise
of the console application!
NuGet Package Installation
Search in NuGet: cap (a poem)
SkiaSharp
Class library installation.
Generate QR code and save as png
var test1 = ("Time chasers!!!" , );
("", 10, 3);
Generate QR code with color and save as png
var test2 = ("Time chasers!!!" , );
("", 12, 4,
foreground: ("#628bb5"),
background: ("#ffffff"));
Generate QR code and save as svg
var test3 = ("Time chasers!!!" , );
var svg = (4);
("", svg, Encoding.UTF8);
Generate QR code with color and save as svg
var test4 = ("Time chasers!!!" , );
var svg1 = (4, "#98b2cd", "#ffffff");
("", svg1, Encoding.UTF8);
Project Source Code
QrCodeGenerator provides a wealth of sample code to show how to use in WinForms, WPF, WinUI, Core and other environments.
WinForms effect
show (a ticket)Demo-WinForms
Project Run:
WPF running effect
show (a ticket)Demo-WindowsPresentationFoundation
Project Run:
Core Runtime Effect
show (a ticket)-Core
Project Run:
Project source code address
More useful features and characteristics of the project welcome to the project open source address to view 👀, do not forget to give the project a Star support 💖.
- Open source address:/manuelbl/QrCodeGenerator
- Online documentation:/QrCodeGenerator/api/
- Example source code:/YSGStudyHards/DotNetExercises/tree/master/QrCodeGeneratorExercise
A selection of great projects and frameworks
This project has been included in the C#/.NET/.NET Core Excellent Projects and Frameworks Selection, focusing on the excellent projects and frameworks selection can let you keep abreast of the latest developments and best practices in the field of C#, .NET and .NET Core, and improve the efficiency and quality of development work. The pit has been dug, you are welcome to submit PR recommendations or self-recommendation (so that excellent projects and frameworks are not buried 🤞).
- /YSGStudyHards/DotNetGuide/blob/main/docs/DotNet/