TerraFluent.Html.Reporting 1.2.0

Prefix Reserved
dotnet add package TerraFluent.Html.Reporting --version 1.2.0
                    
NuGet\Install-Package TerraFluent.Html.Reporting -Version 1.2.0
                    
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="TerraFluent.Html.Reporting" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TerraFluent.Html.Reporting" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="TerraFluent.Html.Reporting" />
                    
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 TerraFluent.Html.Reporting --version 1.2.0
                    
#r "nuget: TerraFluent.Html.Reporting, 1.2.0"
                    
#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 TerraFluent.Html.Reporting@1.2.0
                    
#: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=TerraFluent.Html.Reporting&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=TerraFluent.Html.Reporting&version=1.2.0
                    
Install as a Cake Tool

TerraFluent.Html.Reporting

TerraFluent.Html.Reporting is a fluent, dependency-free .NET library for building paginated, print-ready HTML reports. It gives you fixed page sizes, headers and footers, measured content flow, table/list pagination, and self-contained HTML/CSS that opens in a browser or can be printed to PDF.

Use it when you want PDF-style report layout without taking a dependency on a PDF engine. The library targets netstandard2.0 and net10.0.

View Sample Reports

What's New in 1.2.0

  • AddColumns(columnCount, configure, columnGapPx): opt-in, conservative multi-column ("newspaper-style") content blocks - equal-width columns, fill-then-wrap, splitting across a column boundary just like content already splits across a page boundary. See Rows and Columns: Multi-column sections.
  • AddQrCode(value, moduleWidthPx, quietZoneModules): generates a QR code natively as a PNG, matching AddBarcode's API shape - no external library or web service involved.
  • TextStyle.Direction for right-to-left text (dir/CSS direction), and ReportDocumentBuilder.EmbedFont(...) to embed a custom font as a base64 @font-face rule.
  • ReportDocumentBuilder.Title(...) sets the generated HTML's <title>.
  • LayoutWarning gained structured Reason/ElementType/ElementIndex fields (filterable via the new LayoutWarningReason enum) instead of only a free-form message, and a table/row's auto-width column collapsing to 0px is no longer silent - it now raises a ColumnWidthCollapsed warning, with an opt-in UseStrictLayoutValidation()/ColumnWidthOverflowMode to throw instead.

See CHANGELOG.md for the full release notes.

Install

dotnet add package TerraFluent.Html.Reporting

Quick Start

using TerraFluent.Html.Reporting.Model;

var report = ReportDocument.Create(PageSize.A4, PageOrientation.Portrait)
    .SetMargins(40, 40, 60, 60)
    .Header(header => header
        .AddText("Monthly Sales Report")
        .AlignCenter()
        .Bold())
    .Footer(footer => footer.AddPageNumber("Page {page} of {totalPages}"))
    .Content(content =>
    {
        content.AddHeading("Sales Summary", HeadingLevel.H1);
        content.AddParagraph("This report summarizes sales activity for the period.");
        content.AddImage("logo.png", widthPx: 120, heightPx: 60);

        content.AddTable(table =>
        {
            table.AddColumns("Product", "Qty", "Revenue");
            table.AddRow("Widget A", "120", "$2,400");
            table.AddRow("Widget B", "85", "$1,700");
        });
    })
    .Build();

var html = report.RenderHtml();
report.RenderHtmlDocument("monthly-sales.html");

Open the generated HTML in a browser, or use the browser's print dialog to print or save it as PDF.

What It Supports

  • Fixed page geometry: A4, Letter, Legal, portrait/landscape, or custom sizes.
  • Repeating headers and footers, including page number templates.
  • Paragraphs, headings, images, tables, lists, rules, spacers, page breaks, raw HTML, side-by-side row layouts, and opt-in multi-column ("newspaper-style") sections.
  • Natively generated Code 128 barcode and QR code images - no external library or web service - handy for an invoice number in the header or a tracking number on a label.
  • Table cell ColSpan/RowSpan for merged header/summary cells or grouped categories.
  • Right-to-left text direction and embedded custom fonts.
  • Fluent styling for text, margins, padding, alignment, images, rows, and tables.
  • Pagination with line-level paragraph splitting, table row splitting, repeated table headers, and numbered-list continuation.
  • Layout warnings, categorized via LayoutWarningReason, for content that cannot fit on an empty page or an auto-width table/row column that collapsed to 0px.
  • Document title, rendered into the generated HTML's <title>.
  • Streaming render APIs and async file rendering for larger reports.
  • Extension points for custom elements, renderers, and text measurement.

Text Measurement

Pagination depends on measuring text before it is rendered. The built-in ApproximateTextMeasurer keeps the core package zero-dependency by using generic character-width tables. It is suitable for many reports, but it is not a pixel-perfect browser text layout engine.

If page breaks must match a specific rendering engine exactly, implement ITextMeasurer and pass it to UseTextMeasurer(...) when building the document.

Tested Against Real Browsers

Beyond unit tests for the pagination math itself, CI renders generated reports in real, headless Chromium, Firefox, and WebKit (via Playwright) and asserts every page's rendered geometry matches the requested page size exactly under @media print - the same media browsers use for "Print to PDF". See docs/08-rendering.md.

Documentation

Full documentation and runnable samples live in the GitHub repository:

Status

This library is stable for public use. The current version is 1.2.0. The default text measurer is approximate; supply a custom ITextMeasurer when pagination must match a specific rendering engine pixel-for-pixel.

License

TerraFluent.Html.Reporting is licensed under the MIT License. You can use it in personal, commercial, and open-source projects, modify it, and redistribute it, provided the original license notice is included.

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 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. 
.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

    • No dependencies.
  • net10.0

    • No dependencies.

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.2.0 126 8/29/2026
1.1.1 147 7/3/2026
1.1.0 128 7/3/2026
1.0.0 137 6/30/2026
0.2.0-alpha.1 82 6/28/2026