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
<PackageReference Include="TerraFluent.Html.Reporting" Version="1.2.0" />
<PackageVersion Include="TerraFluent.Html.Reporting" Version="1.2.0" />
<PackageReference Include="TerraFluent.Html.Reporting" />
paket add TerraFluent.Html.Reporting --version 1.2.0
#r "nuget: TerraFluent.Html.Reporting, 1.2.0"
#:package TerraFluent.Html.Reporting@1.2.0
#addin nuget:?package=TerraFluent.Html.Reporting&version=1.2.0
#tool nuget:?package=TerraFluent.Html.Reporting&version=1.2.0
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.
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, matchingAddBarcode's API shape - no external library or web service involved.TextStyle.Directionfor right-to-left text (dir/CSSdirection), andReportDocumentBuilder.EmbedFont(...)to embed a custom font as a base64@font-facerule.ReportDocumentBuilder.Title(...)sets the generated HTML's<title>.LayoutWarninggained structuredReason/ElementType/ElementIndexfields (filterable via the newLayoutWarningReasonenum) 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 aColumnWidthCollapsedwarning, with an opt-inUseStrictLayoutValidation()/ColumnWidthOverflowModeto 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/RowSpanfor 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:
- Documentation index
- Getting started
- Cookbook
- FAQ / Troubleshooting
- Supported Composition Patterns
- Source 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 | Versions 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. |
-
.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 |