Gufel.QrRender
1.0.0
dotnet add package Gufel.QrRender --version 1.0.0
NuGet\Install-Package Gufel.QrRender -Version 1.0.0
<PackageReference Include="Gufel.QrRender" Version="1.0.0" />
<PackageVersion Include="Gufel.QrRender" Version="1.0.0" />
<PackageReference Include="Gufel.QrRender" />
paket add Gufel.QrRender --version 1.0.0
#r "nuget: Gufel.QrRender, 1.0.0"
#:package Gufel.QrRender@1.0.0
#addin nuget:?package=Gufel.QrRender&version=1.0.0
#tool nuget:?package=Gufel.QrRender&version=1.0.0
Gufel Advanced QrCode Svg Render
Based on QRCoder nuget package, this package exports qrcode as high quality verctor svg format with customization and templates. You can also export svg as png or pdf with helper services and tools.
you can build high quality svg qrcode with 20 predefined template.
| <img src="/Asset/template/13.png" width="60%" alt="13"> | <img src="/Asset/template/15.png" width="60%" alt="14"> |
|---|
Features:
- ⭐ Customization of eye color, eye frame and eye
- ⭐ Gradient customization
- ⭐ Ability to define and rotate eye graphics based on placement
- ⭐ Ability to customize all graphics by defining dedicated storage
- ⭐ Template definition to simplify production
- ⭐ PDF and PNG output helper
- ⭐ Sample and Dockerized project
- ⭐ Outputs work on all operating systems: Linux, Mac and Windows
| <img src="/Asset/diff/Vectorized.png" width="60%" alt="13"> | <img src="/Asset/diff/Rasterisation.png" width="60%" alt="14"> |
|---|---|
| Vectorized | Rasterized |
☕ Buy Me a Coffee (Crypto)
I spent many hours and produced a lot of code
testing and testing and testing refactoring and refactoring
If you'd like to support this project, you can send crypto to:
Bitcoin (BTC) 18gMqPRoLmG9vMvFYgdREpAtYPafYC2r5B
Dogecoin (DOGE) DNrtbptXEpWjniJ7zTMH14namJd38494Sv
Sample:
web api sample project found under folder: Gufel.QrRender.SampleWebApi
console project found under folder: Gufel.QrRender.SampleConsoleApp
To start the creation of qrcode, you need qrcode data that can be generated using payload or simple text. reffer to QRCoder for more information.
using var qrCodeData = QRCodeGenerator.GenerateQrCode("https://github.com/mahdiit", QRCodeGenerator.ECCLevel.M);
main class must load resources and svg graphics for creating qrcode, so we need to register default implementation and static content for resource:
services.AddSingleton<ILogoRepository, StaticLogoRepository>();
services.AddSingleton<ILogoLoader, LogoLoader>();
services.AddSingleton<IResourceRepository, StaticResourceRepository>();
note: default resource manger implemented and use static resource that embed in assembly file
next pass qrCodeData to main svg creator:
using var svgRenderer = new SvgQrCode(app.GetRequiredService<IResourceRepository>());
svgRenderer.SetQRCodeData(qrCodeData);
to complete creation of high quality vector qrcode you need to pass options or template. simple way is predefined template. see template list
svgRenderer.GetGraphic(templateId: 1).SvgContent
Convert Helper
there are 3 helpers for converting svg content to pdf or png and each of them has pros and cons and there is a commercial library that can help. in this library use a free/open source and fast solution.
| Method | Platform | Free | Quality |
|---|---|---|---|
| ⭐ Svg.Skia | Cross-platform | ✅ | Excellent |
| ⭐ Magick.NET | Cross-platform | ✅ | Excellent |
| ⭐ Inkscape CLI | Any OS w/ Inkscape | ✅ | Very high |
| Aspose.SVG | Any | ❌ | Enterprise |
| Method | Vector PDF | Cross-Platform | Free | Dependencies |
|---|---|---|---|---|
| Svg.Skia | ✅ | ✅ | ✅ | SkiaSharp + Svg.Skia |
| Aspose.SVG | ✅ | ✅ | ❌ | Paid library |
| Magick.NET | ❌ (raster) | ✅ | ✅ | ImageMagick core |
| Inkscape CLI | ✅ | ✅ | ✅ | Inkscape installed |
Inkscape Cli
for setting inkscape paramater see official inkscape documentation
for working with inkscape, first install Inkscape in os or docker image and then pass execlutable file to helper service:
// Windows
// C:\Program Files\Inkscape\bin\inkscape.exe
// Linux
// usr/bin/inkscape
var inkscape = new InkscapeExportBuilder(path);
inkscape.ExportType([InkscapeExportTypes.pdf, InkscapeExportTypes.png]);
inkscape.InputFile(svgPath);
// default output path is input folder
await inkscape.Execute();
install docker file sample:
USER root
# Install Inkscape
RUN apt-get update && \
apt-get install -y inkscape && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Print Inkscape path and set environment variable
RUN which inkscape
ENV INKSCAPE_PATH=/usr/bin/inkscape
SkiaSharp
SkiaSharpExport.SvgToPdf(svgPath, svgPath + "-skia.pdf");
SkiaSharpExport.SvgToPng(svgPath, svgPath + "-skia.png");
MagickNet
MagickNetExport.SvgToPdf(svgPath, svgPath + "-magick.pdf");
MagickNetExport.SvgToPng(svgPath, svgPath + "-magick.png");
License
By using this software, you agree to the terms of either the GPLv3 license or the commercial license, depending on your use in LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- CliWrap (>= 3.9.0)
- Gufel.EcdKey (>= 1.1.2)
- Gufel.QrRender.Models (>= 1.0.0)
- Magick.NET-Q8-AnyCPU (>= 14.9.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- QRCoder (>= 1.7.0)
- SixLabors.ImageSharp (>= 3.1.11)
- SkiaSharp (>= 3.119.1)
- Svg.Skia (>= 3.2.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 205 | 10/28/2025 |
Init public version