[HttpGet("DownloadInvoice")] public IActionResult DownloadInvoice()

await new BrowserFetcher().DownloadAsync(); using var browser = await Puppeteer.LaunchAsync(new LaunchOptions Headless = true ); using var page = await browser.NewPageAsync(); await page.SetContentAsync(htmlContent); return await page.PdfDataAsync(new PdfOptions Format = PaperFormat.A4 );

page.Margin(30); page.Header().Text("Custom Invoice").Bold().FontSize(20); page.Content().PaddingVertical(10).Table(table =>

var document = new InvoiceDocument(); var pdfBytes = document.GeneratePdf(); return File(pdfBytes, "application/pdf", "custom_invoice.pdf");

Subscribe to our email newsletter