flexrender-cli 0.4.1

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global flexrender-cli --version 0.4.1
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local flexrender-cli --version 0.4.1
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=flexrender-cli&version=0.4.1
                    
nuke :add-package flexrender-cli --version 0.4.1
                    

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.

This package has no dependencies.

Version Downloads Last Updated
0.8.0 80 2/12/2026
0.7.2 83 2/11/2026
0.7.1 77 2/11/2026
0.7.0 81 2/11/2026
0.6.0 84 2/10/2026
0.5.2 81 2/10/2026
0.5.1 80 2/10/2026
0.4.1 87 2/7/2026
0.3.1 84 2/6/2026
0.3.0 86 2/5/2026
0.2.0 92 2/5/2026
0.1.0 84 2/5/2026
0.0.4 89 2/4/2026
0.0.3 84 2/4/2026