FlexRender.DependencyInjection 0.4.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package FlexRender.DependencyInjection --version 0.4.1
                    
NuGet\Install-Package FlexRender.DependencyInjection -Version 0.4.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="FlexRender.DependencyInjection" Version="0.4.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FlexRender.DependencyInjection" Version="0.4.1" />
                    
Directory.Packages.props
<PackageReference Include="FlexRender.DependencyInjection" />
                    
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 FlexRender.DependencyInjection --version 0.4.1
                    
#r "nuget: FlexRender.DependencyInjection, 0.4.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 FlexRender.DependencyInjection@0.4.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=FlexRender.DependencyInjection&version=0.4.1
                    
Install as a Cake Addin
#tool nuget:?package=FlexRender.DependencyInjection&version=0.4.1
                    
Install as a Cake Tool

FlexRender

NuGet NuGet Downloads CI License: MIT

A .NET library for rendering images from YAML templates with a full CSS flexbox layout engine. Perfect for generating receipts, labels, tickets, and structured documents.

Features

  • YAML Templates -- define complex image layouts in readable YAML format
  • Full CSS Flexbox -- direction, wrapping, justify, align, grow/shrink/basis, min/max constraints, auto margins
  • RTL Support -- right-to-left layout with text-direction: rtl, logical alignment (start/end), row mirroring
  • Template Engine -- variables ({{name}}), loops (type: each), conditionals (type: if with 13 operators)
  • Rich Content -- text, images, QR codes (FlexRender.QrCode), barcodes (FlexRender.Barcode), separators
  • HarfBuzz Shaping -- optional FlexRender.HarfBuzz package for Arabic/Hebrew glyph shaping
  • Multiple Formats -- PNG, JPEG (quality 1-100), BMP (6 color modes), Raw pixels
  • Per-Call Options -- antialiasing, font hinting, text rendering mode per render call
  • AOT Compatible -- no reflection, works with Native AOT publishing
  • CLI Tool -- render, validate, watch, and debug templates from the command line

Examples

Receipt Dynamic Receipt Ticket Label
Receipt Dynamic Ticket Label

<details> <summary>Feature Showcase (click to expand)</summary>

Showcase

</details>

Installation

# All-in-one package
dotnet add package FlexRender

# CLI tool
dotnet tool install -g flexrender-cli

Linux / Docker: Add SkiaSharp.NativeAssets.Linux to avoid DllNotFoundException: libSkiaSharp. For HarfBuzz text shaping, also add HarfBuzzSharp.NativeAssets.Linux.

Quick Start

1. Create a template (receipt.yaml):

canvas:
  fixed: width
  width: 300
  background: "#ffffff"

layout:
  - type: flex
    padding: 20
    gap: 10
    children:
      - type: text
        content: "{{shopName}}"
        font: bold
        size: 1.5em
        align: center

      - type: each
        array: items
        as: item
        children:
          - type: flex
            direction: row
            justify: space-between
            children:
              - type: text
                content: "{{item.name}}"
              - type: text
                content: "{{item.price}} $"

      - type: text
        content: "Total: {{total}} $"
        font: bold
        align: right

2. Render with code:

var render = new FlexRenderBuilder()
    .WithSkia(skia => skia.WithQr().WithBarcode())
    .Build();

var data = new ObjectValue
{
    ["shopName"] = "My Shop",
    ["total"] = 1500,
    ["items"] = new ArrayValue(
        new ObjectValue { ["name"] = "Product 1", ["price"] = 500 },
        new ObjectValue { ["name"] = "Product 2", ["price"] = 1000 })
};

byte[] png = await render.RenderFile("receipt.yaml", data);

3. Or use the CLI:

flexrender render receipt.yaml -d data.json -o receipt.png

Documentation

Page Description
Getting Started Installation, first template, rendering approaches
Template Syntax Canvas, all 8 element types, common properties
Element Reference Complete property reference for all element types
Template Expressions Variables, loops, conditionals
Flexbox Layout Direction, justify, align, wrapping, grow/shrink
Render Options Per-call antialiasing, font hinting, format options
CLI Reference Commands, options, AOT publishing
API Reference IFlexRender, builder, DI, types
Contributing Build, test, architecture, conventions

For LLM Agents

  • llms.txt -- concise project overview (~200 lines)
  • llms-full.txt -- comprehensive reference (~600 lines)
  • AGENTS.md -- build commands, coding conventions

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on FlexRender.DependencyInjection:

Package Downloads
FlexRender

All-in-one FlexRender package. Linux/Docker: add SkiaSharp.NativeAssets.Linux to your project.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.8.0 86 2/12/2026
0.7.2 305 2/11/2026
0.7.1 100 2/11/2026
0.7.0 102 2/11/2026
0.6.0 109 2/10/2026
0.5.2 112 2/10/2026
0.5.1 102 2/10/2026
0.5.0 102 2/10/2026
0.4.1 108 2/7/2026
0.3.1 122 2/6/2026
0.3.0 106 2/5/2026
0.2.0 130 2/5/2026
0.1.0 113 2/5/2026
0.0.4 107 2/4/2026
0.0.3 158 2/4/2026