Five-minute quickstart

Your first report in five minutes

Pick an output, add one package, write one fluent builder. All three libraries share the same mental model, so everything you learn transfers.

1. Choose your output

2. Install

dotnet add package TerraFluent.Pdf.Reporting
dotnet add package TerraFluent.Html.Reporting
dotnet add package TerraFluent.Docx.Reporting

Html.Reporting and Docx.Reporting target netstandard2.0 and net10.0, so they run on .NET Framework 4.6.1+, .NET Core 2.0+, and the latest .NET. Pdf.Reporting targets .NET 8, 9, and 10 — all on Windows, Linux, and macOS.

3. Write a report

True PDF

using TerraFluent.Pdf.Reporting.Core;
using TerraFluent.Pdf.Reporting.Helpers;

PdfDocument.Create(container =>
{
    container.Page(page =>
    {
        page.Size(PageSize.A4);
        page.Margin(2, Unit.Centimetre);
        page.DefaultTextStyle(s => s.FontSize(11));

        page.Header().Text("Monthly Sales Report").Bold().FontSize(24);

        page.Content().Column(col =>
        {
            col.Spacing(8);
            col.Item().Text("This report summarizes sales activity for the period.");
            col.Item().Table(table =>
            {
                table.ColumnsDefinition(cols =>
                {
                    cols.RelativeColumn(3);
                    cols.RelativeColumn(1);
                    cols.RelativeColumn(1);
                });
                table.HeaderRow(row =>
                {
                    row.Cell().Padding(6).Text("Product").Bold();
                    row.Cell().Padding(6).AlignCenter().Text("Qty").Bold();
                    row.Cell().Padding(6).AlignRight().Text("Revenue").Bold();
                });
                table.Row(row =>
                {
                    row.Cell().Padding(6).Text("Widget A");
                    row.Cell().Padding(6).AlignCenter().Text("120");
                    row.Cell().Padding(6).AlignRight().Text("$2,400");
                });
            });
        });

        page.Footer().AlignCenter().Text(t =>
        {
            t.Span("Page ");
            t.CurrentPageNumber();
            t.Span(" / ");
            t.TotalPages();
        });
    });
}).PublishPdf("monthly-sales.pdf");

monthly-sales.pdf opens in any PDF viewer — a real PDF 1.7 file, no browser or converter in the loop.

Paginated HTML

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.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();                     // as a string
report.RenderHtmlDocument("monthly-sales.html");    // or straight to a file

Open monthly-sales.html in a browser, then print or save it as PDF from the browser's print dialog. The output is self-contained HTML/CSS — nothing else to deploy.

Native Word document

using TerraFluent.Docx.Reporting;

Document.Create(doc =>
{
    doc.MetadataTitle("Quarterly Report")
       .MetadataAuthor("Northwind Consulting");

    doc.Page(page =>
    {
        page.Size(PageSize.A4);
        page.Margin(Unit.Centimetre(2));
        page.Header().Text("Quarterly Report", t => t.Bold().AlignCenter());
        page.Footer().Text(t =>
        {
            t.Span("Page ");
            t.CurrentPageNumber();
            t.Span(" of ");
            t.TotalPages();
            t.AlignCenter();
        });

        page.Content().H1("Executive Summary");
        page.Content().Text("Revenue improved across every practice.");
    });
}).PublishDocx("quarterly-report.docx");

quarterly-report.docx opens in Microsoft Word or LibreOffice — with real page-number fields and document metadata, not baked-in text.

4. Run the samples

Each repository ships a runnable sample project — the fastest way to see every feature:

# Thirteen PDFs: invoices, brochures, TOC, encryption, barcodes & QR …
dotnet run --project samples/TerraFluent.Pdf.Reporting.Sample

# Thirteen HTML reports: invoices, certificates, barcodes, span tables …
dotnet run --project samples/TerraFluent.Html.Reporting.Sample

# Word documents: invoices, an annual report, template output, layout showcase
dotnet run --project samples/TerraFluent.Docx.Reporting.Sample/TerraFluent.Docx.Reporting.Sample.csproj

Or skip the build entirely and browse the rendered HTML sample reports online.

5. Go deeper