Module · Regira.Office.Barcodes

Barcodes and QR in C#.
Write them, and read them back.

Generating a label and scanning one are both here, behind separate reader and writer interfaces. Output is an image file you can save, compose into a label with the Drawing API, or stamp onto a PDF.

← All Office modules

§ 01The contract

What every provider gives you.

The interfaces below are the part that does not change when you swap the library underneath. Each provider then adds whatever extras its own library exposes.

01

Formats

Code128, Code39, EAN-13, EAN-8, UPC-A, ITF and QR. The format is a value on the input, not a different call.

02

Write

Content, format and size in; an image file out. QRCodeInput converts implicitly from a string, so the common case is one argument.

03

Read

Decode from an uploaded photo or scan. The result carries every code found in the image, not only the first.

04

Compose

The result is an image file, so the Drawing API can place it on a canvas with labels and a background in one request.

Interfaces
IBarcodeServiceIBarcodeWriterIBarcodeReaderIQRCodeServiceIQRCodeWriterIQRCodeReader
§ 02Providers

4 published implementations.

Install the one that fits your runtime and licensing, and name it once at registration. Every package here is published on nuget.org.

QRCoderSpireUziGranotZXing
§ 03In code

Inject the interface. Name the provider once.

The provider appears where the concrete class is constructed, and nowhere else. Always-current samples live in the package documentation.

Write a QR code and a barcode, then read oneC#
// Write a QR code…
IQRCodeService qr = new Regira.Office.Barcodes.ZXing.QRCodeService();
IImageFile code = await qr.Create($"https://example.com/items/{item.Id}");

// …write a Code128 barcode…
IBarcodeService barcodes = new Regira.Office.Barcodes.ZXing.BarcodeService();
IImageFile label = await barcodes.Create(new BarcodeInput
{
    Content = shipment.TrackingCode,
    Format  = BarcodeFormat.Code128,
    Size    = new ImageSize(400, 120)
});

// …and read one back from a photo.
BarcodeReadResult? scanned = await barcodes.Read(uploaded);
string? content = scanned?.Contents?.FirstOrDefault();
§ 04Without .NET

The same thing, over HTTP.

Generate barcode and QR images with configurable content, colour and size, and decode one or all codes from an uploaded image.

Call it from any language.

The free tier needs no key and is rate-limited to 5 requests / 60 s. A trial or commercial key removes the limit — send it in the X-License-Key header.

Also explore

OCR

Read text out of images and scanned documents through one IOcrService — Tesseract for cross-platform, PaddleOCR on Windows.