![]() |
VOOZH | about |
dotnet add package Net.Codecrete.QrCodeGenerator --version 3.0.0
NuGet\Install-Package Net.Codecrete.QrCodeGenerator -Version 3.0.0
<PackageReference Include="Net.Codecrete.QrCodeGenerator" Version="3.0.0" />
<PackageVersion Include="Net.Codecrete.QrCodeGenerator" Version="3.0.0" />Directory.Packages.props
<PackageReference Include="Net.Codecrete.QrCodeGenerator" />Project file
paket add Net.Codecrete.QrCodeGenerator --version 3.0.0
#r "nuget: Net.Codecrete.QrCodeGenerator, 3.0.0"
#:package Net.Codecrete.QrCodeGenerator@3.0.0
#addin nuget:?package=Net.Codecrete.QrCodeGenerator&version=3.0.0Install as a Cake Addin
#tool nuget:?package=Net.Codecrete.QrCodeGenerator&version=3.0.0Install as a Cake Tool
Open-source library for generating QR codes from text strings and byte arrays.
The library is built for .NET Standard 2.0 and therefore runs on most modern .NET platforms (.NET Core, .NET Framework, Mono etc.) including .NET 6 on all platforms.
It started as a C# port of Project Nayuki's Java version. Version 3 is a complete rewrite of the library, and it is more standard compliant and about 10x faster than the original implementation.
Core features:
Advanced features:
Create a new Visual Studio project for .NET 8 (or higher) (File > New > Project... / Visual C# > .NET Core > Console App (.NET Core))
Add the library via NuGet:
Either via Project > Manage NuGet Packages... / Browse / search for qrcodegenerator / Install
Or by running a command in the Package Manager Console
Install-Package Net.Codecrete.QrCodeGenerator -Version 3.0.0
Add the code from the example below
Run it
Simple operation
using System.IO;
using System.Text;
using Net.Codecrete.QrCodeGenerator;
namespace Examples
{
class SimpleOperation
{
static void Main()
{
var qr = QrCode.EncodeText("Hello, world!", QrCode.Ecc.Medium);
string svg = qr.ToSvgString(4);
File.WriteAllText("hello-world-qr.svg", svg, Encoding.UTF8);
}
}
}
Manual operation
using Net.Codecrete.QrCodeGenerator;
namespace Examples
{
class ManualOperation
{
static void Main()
{
var qrCode = QrCode.EncodeTextAdvanced("3141592653589793238462643383",
QrCode.Ecc.High, eci: ECI.Latin9, minVersion: 5, maxVersion: 5);
foreach (var rect in qrCode.ToRectangles())
{
... paint rectangle rect.X, rect.Y, rect.Width, rect.Height
}
}
}
}
QR Code Generator for .NET requires a .NET implementation compatible with .NET Standard 2.0 or higher, i.e. any of:
Starting with .NET 6, System.Drawing is only supported on Windows operating system and thus cannot be used for multi-platform libraries like this one. Therefore, ToBitmap() has been removed.
Two raster bitmap formats are supported with the need for additional libraries:
QrCode.ToPngBitmap()QrCode.ToBmpBitmap()These methods are limited, e.g. with regards to the size of the generated image. For more advanced and more efficient ways to generate different raster image formats:
QrCodeBitmapExtensions.cs file to your project| Imaging library | Recommendation | NuGet dependencies | Extension file |
|---|---|---|---|
| System.Drawing | For Windows only projects | System.Drawing.Common |
QrCodeBitmapExtensions.cs |
| SkiaSharp | For macOS, Linux, iOS, Android and multi-platform projects | SkiaSharp and SkiaSharp.NativeAssets.Linux (for Linux only) |
QrCodeBitmapExtensions.cs |
| ImageSharp | Alternative for multi-platform projects. Might require a commercial license. | SixLabors.ImageSharp.Drawing |
QrCodeBitmapExtensions.cs |
Using these extension methods, generating PNG images is straight-forward:
using Net.Codecrete.QrCodeGenerator;
namespace Examples
{
class PngImage
{
static void Main()
{
var qr = QrCode.EncodeText("Hello, world!", QrCode.Ecc.Medium);
qr.SaveAsPng("hello-world-qr.png", 10, 3);
}
}
}
Several example projects demonstrate how to generate QR code with different frameworks and libraries:
Basic-Example: Demonstrates the basic use of the libraries (different texts, error correction level). All QR codes are saved as either SVG, PNG or BMP files.
Demo-WinUI: Demonstrates how QR codes can be used in WinUI 3 applications and/or using Win2D (incl. copying to the clipboard).
Demo-WindowsPresentationFoundation: Demonstrates how QR codes can be used in WPF applications (incl. copying to the clipboard).
Demo-WinForms: Demonstrates how QR codes can be used in Windows Forms applications (incl. copying to the clipboard).
Demo-ASP.NET-Core: Demonstrates how to create QR codes in a web application implemented using ASP.NET Core.
Demo-VCard: Demonstrates how contact data (similar to business cards) can be saved in a QR Code using the VCard standard.
Demo-System-Drawing: Demonstrates how a QR code can be saved a PNG file, using the System.Drawing classes, which have become a Windows only technology starting with .NET 6.
Demo-SkiaSharp: Demonstrates how a QR code can be saved a PNG file, using the SkiaSharp multi-platform raster image library.
Demo-ImageSharp: Demonstrates how a QR code can be saved a PNG file, using the ImageSharp raster image library. Additionally, a QR code with an image in the center is created.
Demo-ImageMagick: Demonstrates how a QR code can be saved a PNG file, using the Magick.NET image manipulation library (based on ImageMagick).
If your code uses QrCode.EncodeText() for generating QR codes, recompiling the code should be sufficient.
The generated QR code will not be an exact 1-to-1 match. Version 3 optimizes the data segments and thus can achieve a smaller QR code or a higher error correction level for the same text. Furthermore, if the text cannot be encoded in Latin-1, it will be encoded in UTF-8 together with an ECI designator indicating it. This is more standard-compliant than the previous version. Further differences can arise from a different data mask selection. In most cases, the differences will be irrelevant.
If your code uses QrSegment.MakeSegments() or other advanced methods,
you might first want to look at QrCode.EncodeTextAdvanced(). If this is not
sufficient for your use case, it is still possible to create the data segments
manually. The class is now called DataSegment instead of QrSegment.
The new library version no longer allows to select a specific data masking pattern as it can lead to QR codes that a very difficult to scan and violate the standard. For backward compatibility, the parameter is still present in one of the methods. But it is ignored.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Net.Codecrete.QrCodeGenerator:
| Package | Downloads |
|---|---|
|
Codecrete.SwissQRBill.Core
Generates the new QR bills for invoicing in Switzerland. The Swiss QR bill library: - is a minimal, platform-independent library supporting PDF and SVG (see homge page for PNG and EMF), - parses the invoice data embedded in the QR code, - generates payment slips (105mm by 210mm), A4 sheets or QR codes, - is multilingual: German, French, Italian, English, Romansh, - validates the invoice data and provides detailed validation information, - adds and retrieves structured bill information (according to Swico S1), - is easy to use and comes with many examples, - is small and fast, - is free – even for commecial use (MIT License), - is built for .NET Standard 2.0 and runs on all modern .NET platforms. See home page https://github.com/manuelbl/SwissQRBill.NET for examples and other library versions. |
|
|
Aiursoft.WebTools
A tool for web development. |
|
|
PinguApps.Blazor.QRCode
A Blazor component for generating QR codes. This component encodes specified data into a QR code image, which can be customized in terms of size, colors, and error correction level. The QR code is generated as an SVG for optimal scalability and clarity. |
|
|
NineDigit.eKasa
eKasa PPEKK solution by Nine Digit, s.r.o. |
|
|
LeadSoft.Common.Library
LeadSoft® Common utilities methods and classes. |
Showing the top 14 popular GitHub repositories that depend on Net.Codecrete.QrCodeGenerator:
| Repository | Stars |
|---|---|
|
BeyondDimension/SteamTools
🛠「Watt Toolkit」是一个开源跨平台的多功能 Steam 工具箱。
|
|
|
LagrangeDev/Lagrange.Core
An Implementation of NTQQ Protocol, with Pure C#, Derived from Konata.Core
|
|
|
ClassIsland/ClassIsland
一款功能强、可定制、跨平台,适用于班级多媒体屏幕的课表信息显示工具,可以一目了然地显示各种信息。
|
|
|
sipsorcery-org/sipsorcery
A WebRTC, SIP and VoIP library for C# and .NET. Designed for real-time communications apps.
|
|
|
CHKZL/DDTV
可对阿B进行直播多窗口观看、开播提醒、自动录制、合并、转码的跨平台工具
|
|
|
YSGStudyHards/DotNetExercises
⚔【DotNetGuide专栏C#/.NET/.NET Core编程技巧练习集】C#/.NET/.NET Core编程常用语法、算法、技巧、中间件、类库、工作业务实操练习集,配套详细的文章教程和代码示例,助力快速掌握C#/.NET/.NET Core中各种编程常用语法、算法、技巧、中间件、类库、工作业务实操等等。
|
|
|
CervantesSec/cervantes
Cervantes is an open-source, collaborative platform designed specifically for pentesters and red teams. It serves as a comprehensive management tool, streamlining the organization of projects, clients, vulnerabilities, and reports in a single, centralized location.
|
|
|
neozhu/visitormanagement
helps in managing visitors visiting the institutions for various reasons. It allows visitors to check-in digitally to eliminate the tedious registeration and other paperwork. Additionally, it also keeps a track of every individual inside the campus and their timings. Institutions has guards who enter their detail in some notebooks to keep a log which are practically impossible to reconcile. It is really unpleasent and hectic for visitor to stand at the gate and give details about the visit. To ease the process of registeration, Entry-In, Entry-Out, time tracking and logging the history, this VMS can be of great use!!
|
|
|
guitarrapc/SkiaSharp.QrCode
High-performance QR code generation with SkiaSharp integration.
|
|
|
neozhu/cleanaspire
CleanAspire is a cloud-native template built on Aspire, using .NET 10 Minimal APIs and Blazor WebAssembly to deliver lightweight, scalable PWAs with offline support.
|
|
|
LagrangeDev/LagrangeV2
The V2 Implementation of Lagrange.Core, aim to provide more user-friendly interface and extreme efficiency (This is only a development repo, would be removed in future)
|
|
|
aiguoli/SimpleList
Manage your OneDrive files on WinUI3 powered app
|
|
|
UnrealMultiple/TShockPlugin
TShock插件收集仓库
|
|
|
manuelbl/SwissQRBill.NET
.NET library for Swiss QR bill payment slips (aka QR-Rechnung)
|
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0 | 11,534 | 5/25/2026 |
| 2.1.0 | 198,023 | 12/30/2025 |
| 2.0.7 | 220,072 | 7/14/2025 |
| 2.0.6 | 598,868 | 12/7/2024 |
| 2.0.5 | 826,291 | 3/23/2024 |
| 2.0.4 | 938,930 | 10/13/2023 |
| 2.0.3 | 827,502 | 7/4/2022 |
| 2.0.2 | 1,366 | 7/4/2022 |
| 2.0.1 | 505,713 | 12/10/2021 |
| 2.0.0 | 381,091 | 11/14/2021 |
| 2.0.0-rc.1 | 7,748 | 8/24/2021 |
| 1.6.1 | 260,112 | 10/19/2020 |
| 1.6.0 | 38,079 | 7/5/2020 |
| 1.5.0 | 126,425 | 10/20/2019 |
| 1.4.1 | 13,321 | 2/20/2019 |
| 1.4.0 | 2,968 | 2/10/2019 |
New in releases 3.0:
- Complete rewrite of library: 10x faster
- Better standard compliance for text encoding and ECI designators