void ComposeFooter(IContainer container) => container.AlignCenter().Text(x => x.Span("Page "); x.CurrentPageNumber(); ); [HttpGet("generate-invoice")] public IActionResult GenerateInvoice()

void ComposeHeader(IContainer container)

void ComposeContent(IContainer container)

public DocumentMetadata GetMetadata() => DocumentMetadata.Default;

For developers seeking a production-ready, completely free, and customizable PDF solution, start with and explore HTML-to-PDF options for legacy HTML designs. Note : Always review the license of any library (LGPL, MIT, etc.) to ensure compliance with your distribution model. The libraries mentioned above are safe for commercial use under their respective open-source licenses.

var model = new InvoiceModel /* populate data */ ; var document = new InvoiceDocument(model); var pdfBytes = document.GeneratePdf(); return File(pdfBytes, "application/pdf", "Invoice.pdf"); If you prefer using HTML/CSS for layout (like building a webpage), DinkToPdf is ideal. Install DinkToPdf dotnet add package DinkToPdf dotnet add package DinkToPdf.AspNetCore Custom HTML Template var converter = new BasicConverter(new PdfTools()); var doc = new HtmlToPdfDocument()