FoxPrint.QrCodeGenerator 1.0.1

dotnet add package FoxPrint.QrCodeGenerator --version 1.0.1
                    
NuGet\Install-Package FoxPrint.QrCodeGenerator -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FoxPrint.QrCodeGenerator" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FoxPrint.QrCodeGenerator" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="FoxPrint.QrCodeGenerator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FoxPrint.QrCodeGenerator --version 1.0.1
                    
#r "nuget: FoxPrint.QrCodeGenerator, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FoxPrint.QrCodeGenerator@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FoxPrint.QrCodeGenerator&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=FoxPrint.QrCodeGenerator&version=1.0.1
                    
Install as a Cake Tool

FoxPrint - Receipt QR Code Generator

NuGet NuGet Downloads .NET Standard 2.0 License: MIT CI

FoxPrint is a library that enables POS systems to generate cryptographically-signed QR codes for printing on receipts. These QR codes allow customers to scan and pay directly through FoxNest without requiring real-time API calls during receipt printing.

Key Features

  • Stateless & Secure - No database lookups, HMAC-SHA256 signed slugs
  • Multi-tenant by Design - One POS integration handles multiple stores
  • Platform Agnostic - .NET Standard 2.0 ensures compatibility with older systems
  • Zero Backend Dependency at Print Time - POS generates QR codes client-side
  • Printer-Optimized - Specialized formats for thermal and receipt printers
  • Multiple Image Formats - PNG, BMP output

Installation

dotnet add package FoxPrint.QrCodeGenerator

Or via Package Manager Console:

Install-Package FoxPrint.QrCodeGenerator

Or add to your .csproj:

<PackageReference Include="FoxPrint.QrCodeGenerator" Version="1.0.0" />

Quick Start

Basic Usage (URL Generation Only)

using FoxPrint;

// Initialize once per store (e.g., at application startup)
var generator = new ReceiptQRGenerator(
    storeId: "store_abc_123",
    sharedSecret: "your-shared-secret-from-foxnest"
);

// Generate QR code URL for each receipt
string qrUrl = generator.GenerateQRCodeUrl(tableNumber: "TABLE-15");

Console.WriteLine(qrUrl);
// Output: https://api.foxnest.com/v1/scan/c3RvcmVfYWJjXzEyMzpUQUJMRS0xNToxNzA0MDY3MjAwOmEzZjU...

Complete Usage (With Image Generation)

using FoxPrint;
using FoxPrint.Models;

// Initialize generators
var qrGenerator = new ReceiptQRGenerator("store_abc_123", "your-secret");
var imageGenerator = new QRCodeImageGenerator();

// Generate QR code URL
string qrUrl = qrGenerator.GenerateQRCodeUrl("TABLE-15");

// Generate QR code image for thermal printer (80mm paper)
byte[] thermalQR = imageGenerator.GenerateForThermalPrinter(qrUrl, size: 200);
File.WriteAllBytes("receipt_qr.bmp", thermalQR);

// Generate QR code image for receipt printer (58mm paper, ESC/POS)
byte[] receiptQR = imageGenerator.GenerateForReceiptPrinter(qrUrl, size: 150);
File.WriteAllBytes("receipt_qr_small.bmp", receiptQR);

// Custom options
byte[] customQR = imageGenerator.GenerateImage(qrUrl, new QRCodeOptions
{
    Size = 300,
    Format = ImageFormat.PNG,
    ErrorCorrection = ErrorCorrectionLevel.High,
    Monochrome = true
});

API Reference

ReceiptQRGenerator

public class ReceiptQRGenerator
{
    // Constructor
    public ReceiptQRGenerator(string storeId, string sharedSecret, string baseUrl = "https://api.foxnest.com");

    // Generate QR code URL
    public string GenerateQRCodeUrl(string tableNumber);

    // Verify a QR code slug (for testing)
    public bool VerifySlug(string slug, out string tableNumber);

    // Extract slug from URL
    public static string ExtractSlugFromUrl(string url);

    // Properties
    public string StoreId { get; }
    public string BaseUrl { get; }
}

QRCodeImageGenerator

public class QRCodeImageGenerator
{
    // Generate image with options
    public byte[] GenerateImage(string url, QRCodeOptions options = null);

    // Generate and save to file
    public void GenerateImageToFile(string url, string filePath, QRCodeOptions options = null);

    // Convenience methods
    public byte[] GenerateForThermalPrinter(string url, int size = 200);
    public byte[] GenerateForReceiptPrinter(string url, int size = 150);
}

QRCodeOptions

public class QRCodeOptions
{
    public int Size { get; set; } = 200;                          // 50-1000 pixels
    public ImageFormat Format { get; set; } = ImageFormat.PNG;    // PNG, BMP
    public ErrorCorrectionLevel ErrorCorrection { get; set; }     // Low, Medium, Quartile, High
    public bool Monochrome { get; set; } = false;                 // Black & white only
    public PrinterType PrinterType { get; set; }                  // None, Thermal, Receipt, Laser

    // Factory methods
    public static QRCodeOptions ThermalPrinter(int size = 200);
    public static QRCodeOptions ReceiptPrinter(int size = 150);
}

Error Correction Levels

Level Recovery QR Size Use Case
Low 7% Smallest Clean environments (receipt printers)
Medium 15% Medium Recommended for most cases
Quartile 25% Large Dirty/damaged environments
High 30% Largest Maximum protection

Printer Optimization

Thermal Printers (80mm paper)

byte[] qr = imageGenerator.GenerateForThermalPrinter(url, 200);
// - BMP format, Monochrome (high contrast), 200x200 pixels, Medium error correction

Receipt Printers (58mm paper, ESC/POS)

byte[] qr = imageGenerator.GenerateForReceiptPrinter(url, 150);
// - BMP format, Monochrome, 150x150 pixels, Low error correction (smaller QR code)

Platform Compatibility

  • .NET Framework 4.6.1+
  • .NET Core 2.0+
  • .NET 5, 6, 7, 8, 10+
  • Mono, Xamarin, Unity (2018.1+)

Security Features

Feature Description
HMAC-SHA256 Signature Cryptographically signed to prevent tampering
Stateless Design No database lookups, fully self-contained
Timestamp Included Supports expiration validation
Constant-Time Comparison Prevents timing attacks

Building from Source

# Clone repository
git clone https://github.com/The-Digital-Fox/fox_print.git
cd fox_print

# Build
dotnet build

# Run tests
dotnet test

# Run sample
dotnet run --project samples/ConsoleSample

Versioning

This project follows Semantic Versioning 2.0.0:

  • MAJOR version: Incompatible API changes
  • MINOR version: New functionality (backwards compatible)
  • PATCH version: Bug fixes (backwards compatible)

See CHANGELOG.md for version history.

License

MIT License - see LICENSE file for details.

Support


Version: 1.0.0 | Status: Production Ready

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

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.1 187 1/28/2026
1.0.0 141 1/14/2026