FluentReport 2.0.0
dotnet add package FluentReport --version 2.0.0
NuGet\Install-Package FluentReport -Version 2.0.0
<PackageReference Include="FluentReport" Version="2.0.0" />
<PackageVersion Include="FluentReport" Version="2.0.0" />
<PackageReference Include="FluentReport" />
paket add FluentReport --version 2.0.0
#r "nuget: FluentReport, 2.0.0"
#:package FluentReport@2.0.0
#addin nuget:?package=FluentReport&version=2.0.0
#tool nuget:?package=FluentReport&version=2.0.0
FluentReport
PDF renderer for FluentReport: build reports with a fluent C# API and render them to PDF (or PNG) with SkiaSharp. Works on Windows, macOS and Linux.
Installation
dotnet add package FluentReport
Quick start
using FluentReport;
using FluentReport.Core;
Document.Create(c => c.Page(page =>
{
page.Size(PageSizes.A4);
page.MarginAll(40);
page.Header().Text("Sales report").FontSize(18).Bold();
page.Content().Table(table =>
{
table.ColumnsDefinition(cols => { cols.RelativeColumn(3); cols.ConstantColumn(80); });
table.Header(h =>
{
h.Cell().Background("#1F3864").Padding(4).Text("Product").Bold().Color("#FFFFFF");
h.Cell().Background("#1F3864").Padding(4).Text("Price").Bold().Color("#FFFFFF");
});
foreach (var p in products)
{
table.Cell().Padding(3).Text(p.Name);
table.Cell().Padding(3).Text(p.Price.ToString("N2")).AlignRight();
}
table.Footer(f =>
{
f.Cell().Padding(4).Text("Total").Bold();
f.Cell().Padding(4).Text(total.ToString("N2")).Bold().AlignRight();
});
});
page.Footer().AlignRight().Text(x => { x.Span("Page "); x.CurrentPageNumber(); x.Span(" of "); x.TotalPages(); })
.FontSize(8);
}))
.GeneratePdf("report.pdf");
Pagination
Content flows across as many pages as it needs, with the header and footer repeated on each page:
- columns split between items, also when nested or wrapped in padding, background or border;
- text splits between lines;
- tables split between rows, repeat their header rows and keep footer rows on the last page;
PageBreak()starts a new page at any depth (leading, repeated and trailing breaks add no blank pages).
Rows, images, charts and canvases are not split: they move to the next page, and one taller than a whole page is cut at the footer.
API
| Method | Description |
|---|---|
.GeneratePdf(path\|stream\|—, options?) |
PDF to a file, a stream or a byte[] |
.GenerateImages(scale = 1, options?) |
One PNG per page (scale = pixels per point) |
.GetPdfPageCount(options?) |
Number of pages |
container.Canvas(width, height, (SKCanvas canvas, SKRect rect) => …) |
Custom vector drawing (PDF only) |
PdfOptions: FontResolver (e.g. embedded fonts; returned typefaces are cached and never disposed), Title, Author.
var regular = SKTypeface.FromFile("fonts/Inter-Regular.ttf");
var bold = SKTypeface.FromFile("fonts/Inter-Bold.ttf");
doc.GeneratePdf("report.pdf", new PdfOptions
{
FontResolver = style => style.EffectiveBold ? bold : regular,
Title = "Sales report"
});
Fonts are embedded whole (SkiaSharp does not subset them), which adds a few hundred KB per font face to each PDF.
Ecosystem packages
| Package | Purpose |
|---|---|
FluentReport |
PDF renderer (this package) |
FluentReport.Html |
HTML / email renderer |
FluentReport.Excel |
Excel (.xlsx) renderer |
FluentReport.Rdlc |
RDLC / SSRS importer |
FluentReport.Core |
Document model and fluent API |
Full documentation is available in the repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- FluentReport.Core (>= 2.0.0)
- SkiaSharp (>= 3.119.4)
- SkiaSharp.NativeAssets.Linux.NoDependencies (>= 3.119.4)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on FluentReport:
| Package | Downloads |
|---|---|
|
FluentReport.Schema
YAML/JSON schema translation layer for FluentReport — import editor schema files and render them via the FluentReport pipeline (PDF, PNG, Excel, HTML). |
|
|
UruFactura.Pdf
Representación impresa de los CFE de UruFactura: PDF A4, PDF térmico (80 mm) y código QR según la normativa de la DGI. |
GitHub repositories
This package is not used by any popular GitHub repositories.