FlexRender.Core 0.4.1

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

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (13)

Showing the top 5 NuGet packages that depend on FlexRender.Core:

Package Downloads
FlexRender.Svg.Render

SVG vector output renderer for FlexRender. Generates scalable SVG from the same layout tree.

FlexRender.Skia.Render

SkiaSharp rendering for FlexRender. Linux/Docker: add SkiaSharp.NativeAssets.Linux to your executable project.

FlexRender.DependencyInjection

Microsoft.Extensions.DependencyInjection integration for FlexRender.

FlexRender.Yaml

YAML template parsing for FlexRender.

FlexRender.Barcode.Skia.Render

Barcode generation for FlexRender (Skia renderer).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.11.4 404 3/8/2026
0.11.3 408 3/8/2026
0.11.2 404 3/8/2026
0.11.1 427 3/8/2026
0.11.0 411 3/6/2026
0.10.0 416 3/5/2026
0.9.0 1,240 2/26/2026
0.8.0 447 2/12/2026
0.7.2 1,298 2/11/2026
0.7.1 445 2/11/2026
0.7.0 451 2/11/2026
0.6.0 460 2/10/2026
0.5.2 565 2/10/2026
0.5.1 164 2/10/2026
0.5.0 158 2/10/2026
0.4.1 217 2/7/2026
0.3.1 236 2/6/2026
0.3.0 216 2/5/2026
0.2.0 217 2/5/2026
0.1.0 199 2/5/2026
Loading failed