1

I am using NReco.PdfGenerator.HtmlToPdfConverter to convert my html text to a pdf and everything seems fine except one thing:

I want to print a line below my page header and it doesn't show it. Have I put it in the wrong place?

 public byte[] CreatePdfContent(string htmlContent, string title)
    {
        var generator = new NReco.PdfGenerator.HtmlToPdfConverter
        {
            Orientation = NReco.PdfGenerator.PageOrientation.Portrait,
            Margins = new PageMargins() { Bottom = 30, Left = 20, Right = 20, Top = 30 },
            LowQuality = true,
            PageHeaderHtml = $@"<div style='border-bottom: 1px solid #e5e5e5;width: 500px;text-align: left;'>{title}</div>"
        };
        return generator.GeneratePdf(htmlContent);
    }

I mean, if I take out my div and run it as a normal html code, it works and prints a line below my title but in my pdf it only prints the text without the line.

<div style='border-bottom: 1px solid #e5e5e5;width: 500px;text-align: left;'>title</div>
Ashkan S
  • 10,464
  • 6
  • 51
  • 80
  • I tried to reproduce the issue but with single-line "title" content I was able to get header with the border-bottom line. Possibly you have a long title that leads to multi-line content in the header? – Vitaliy Fedorchenko Oct 02 '17 at 12:19

0 Answers0