I am using a HTML to PDF converter called Nreco and using the tool, i am creating PDF files based on a HTML template using C#.
Everything seems to be working fine apart from the fact that i can`t get the PDF to be shown in Full PDF page (i.e there are white bars around the PDF). I was able to play around with the Margins to get the Top and bottom Margins sorted out but the left and right are still causing issues. There is also extra blank space below the page which makes me think that the converted PDF is not on an A4 size even though i am defining the Page size.
Can anyone help me on this?
The code i am using is as below:
var pageMargins = new NReco.PdfGenerator.PageMargins { Bottom = 0, Left = 0, Right = 0, Top = 0 };
var htmlContent = HTMLPart1 + FinalHTMLPart2 + HTMLPart3;
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
htmlToPdf.Size = NReco.PdfGenerator.PageSize.A4;
htmlToPdf.Margins = pageMargins;
var path = Server.MapPath("~/PDF/" + FileName);
var path2 = path.ToString();
//var pdfBytes = htmlToPdf.GeneratePdf(htmlContent);
htmlToPdf.GeneratePdf(htmlContent, null, path2);
A screenshot to show you what i mean: