Skip to content

elbruno/ElBruno.QRCodeGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ElBruno.QRCodeGenerator

CI Build Publish to NuGet License: MIT GitHub

A family of .NET libraries for QR code generation 🟦

ElBruno.QRCodeGenerator is a suite of .NET libraries for generating QR codes in various formats β€” from console rendering to image generation. Built for developers who need flexible, easy-to-use QR code tools.

Packages

Package NuGet Downloads Description
ElBruno.QRCodeGenerator.CLI NuGet Downloads Console QR codes with Unicode blocks
ElBruno.QRCodeGenerator.Payloads NuGet Downloads Fluent payload builders (WiFi, vCard, SMS, Geo, Email, URL)
ElBruno.QRCodeGenerator.Svg NuGet Downloads Resolution-independent SVG QR codes
ElBruno.QRCodeGenerator.Image NuGet Downloads PNG/JPEG/WebP bitmap QR codes (SkiaSharp)
ElBruno.QRCodeGenerator.Ascii NuGet Downloads ASCII art QR codes for text output
ElBruno.QRCodeGenerator.Pdf NuGet Downloads PDF documents with embedded QR codes
ElBruno.QRCodeGenerator.Tool NuGet Downloads qrgen global dotnet tool for all formats

ElBruno.QRCodeGenerator.CLI

Generate and display QR codes in the console using Unicode block characters

The CLI package is a lightweight .NET library that creates beautiful QR codes in your terminal with Unicode block characters. Perfect for CLI tools, server logs, and terminal applications.

Features

  • 🎯 Simple API - Generate QR codes with one line of code: QRCode.Print("your text")
  • πŸ–₯️ Console-Optimized - Uses Unicode block characters for perfect 2:1 aspect ratio in terminals
  • 🎨 Theme Support - Built-in light/dark theme support with color inversion
  • πŸ“¦ Multi-Target - .NET 8.0 and .NET 10.0 support
  • βœ… Battle-Tested - Built on QRCoder, the most popular .NET QR encoder
  • πŸ”§ Configurable - Adjust error correction, quiet zone, and rendering options

Installation

dotnet add package ElBruno.QRCodeGenerator.CLI

Quick Start

Print to Console

using ElBruno.QRCodeGenerator.CLI;

// Simplest possible usage
QRCode.Print("https://github.com/elbruno");

Get QR Code as String

using ElBruno.QRCodeGenerator.CLI;

// Generate QR code and capture as string
string qrCode = QRCode.Generate("Hello, World!");
Console.WriteLine(qrCode);

Samples

See src/samples/BasicQRCode for the complete CLI example.


ElBruno.QRCodeGenerator.Payloads

Fluent payload builders for WiFi, vCard, Email, SMS, Geo, and URL QR codes

Zero external dependencies β€” pure string formatting that works with any QR code renderer.

Installation

dotnet add package ElBruno.QRCodeGenerator.Payloads

Quick Start

using ElBruno.QRCodeGenerator.Payloads;

// WiFi network QR code
var wifi = PayloadBuilder.Wifi("MyNetwork", "MyPassword123");
Console.WriteLine(wifi.GetPayloadString());
// Output: WIFI:T:WPA;S:MyNetwork;P:MyPassword123;;

// vCard contact
var vcard = PayloadBuilder.VCard("Bruno Capuano")
    .WithPhone("+1234567890", VCardPhoneType.Mobile)
    .WithEmail("bruno@example.com", VCardEmailType.Work)
    .WithOrganization("Contoso");
Console.WriteLine(vcard.GetPayloadString());

// Combine with any renderer (e.g., CLI)
QRCode.Print(wifi.GetPayloadString());

πŸ“‚ Full Payloads sample | πŸ“– API Reference


ElBruno.QRCodeGenerator.Svg

Generate resolution-independent SVG QR codes

Installation

dotnet add package ElBruno.QRCodeGenerator.Svg

Quick Start

using ElBruno.QRCodeGenerator.Svg;

// Generate an SVG QR code
var svg = SvgQRCode.Generate("https://github.com/elbruno");
File.WriteAllText("qrcode.svg", svg);

// Custom colors and sizing
var customSvg = SvgQRCode.Generate("Hello, World!", svgOptions: new SvgOptions
{
    ForegroundColor = "#003366",
    BackgroundColor = "#f0f0f0",
    ModuleSize = 8
});

πŸ“‚ Full SVG sample | πŸ“– API Reference


ElBruno.QRCodeGenerator.Image

Generate PNG, JPEG, and WebP QR code bitmaps using SkiaSharp

Installation

dotnet add package ElBruno.QRCodeGenerator.Image

Quick Start

using ElBruno.QRCodeGenerator.Image;

// Save as PNG
byte[] png = ImageQRCode.ToPng("https://github.com/elbruno");
File.WriteAllBytes("qrcode.png", png);

// Save as JPEG with custom quality
byte[] jpg = ImageQRCode.ToJpeg("Hello, World!", quality: 90);
File.WriteAllBytes("qrcode.jpg", jpg);

πŸ“‚ Full Image sample | πŸ“– API Reference


ElBruno.QRCodeGenerator.Ascii

Generate QR codes as ASCII art text

Installation

dotnet add package ElBruno.QRCodeGenerator.Ascii

Quick Start

using ElBruno.QRCodeGenerator.Ascii;

// Default block style
AsciiQRCode.Print("https://github.com/elbruno");

// Hash style for text files
var ascii = AsciiQRCode.Generate("Hello!", asciiOptions: new AsciiOptions
{
    Style = AsciiStyle.Hash
});
File.WriteAllText("qrcode.txt", ascii);

πŸ“‚ Full ASCII sample | πŸ“– API Reference


ElBruno.QRCodeGenerator.Pdf

Embed QR codes in PDF documents

Installation

dotnet add package ElBruno.QRCodeGenerator.Pdf

Quick Start

using ElBruno.QRCodeGenerator.Pdf;

// Generate a PDF with a QR code
PdfQRCode.Save("https://github.com/elbruno", "qrcode.pdf");

// With title and custom options
PdfQRCode.Save("https://github.com/elbruno", "styled.pdf", pdfOptions: new PdfOptions
{
    Title = "Scan Me!",
    ModuleSize = 3.0
});

πŸ“‚ Full PDF sample | πŸ“– API Reference


ElBruno.QRCodeGenerator.Tool

qrgen β€” global dotnet tool for all QR code formats

Installation

dotnet tool install -g ElBruno.QRCodeGenerator.Tool

Quick Start

# Console output (default)
qrgen "https://github.com/elbruno"

# Save as SVG
qrgen "Hello World" --format svg --output hello.svg

# Save as PNG with custom colors
qrgen "Hello" --format png --output hello.png --fg "#003366" --bg "#f0f0f0"

# ASCII art
qrgen "Hello" --format ascii --ascii-style dot

# PDF with title
qrgen "https://example.com" --format pdf --output qr.pdf --title "Scan Me"

Building from Source

git clone https://github.com/elbruno/ElBruno.QRCodeGenerator.git
cd ElBruno.QRCodeGenerator
dotnet build
dotnet test

Documentation

  • API Reference - Complete API documentation and configuration examples
  • Publishing Guide - How to publish to NuGet (trusted publishing via OIDC)
  • Changelog - Version history and release notes

License

MIT License - see LICENSE for details.

Author

πŸ‘€ Bruno Capuano (ElBruno)

Acknowledgments

Built with QRCoder β€” the most popular .NET QR encoder.