Wednesday, 17 January 2018

Create PDF from HTML using NReco.PdfGenerator with page number

var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
htmlToPdf.PageFooterHtml = @"<div style='text-align:right; font-size:14px;'>Page <span class=""page""></span> of &nbsp;<span class=""topage""></span><div>";
htmlToPdf.Margins.Top = 15;
htmlToPdf.Margins.Bottom = 15;
htmlToPdf.Margins.Left = 8;
htmlToPdf.Margins.Right = 8;

var pdfBytes = htmlToPdf.GeneratePdf(HtmlFile);
File.WriteAllBytes(newpath, pdfBytes);


No comments:

SQL: Generate a range of numbers

SELECT ones.n + 10*tens.n + 100*hundreds.n + 1000*thousands.n FROM       (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) ones(n),      (VALU...