0

public string GeneratePdfReport(string htmlTemplate, string path, string headerTemplate, string auditBy) {

        var globalSettings = new GlobalSettings
        {
            ColorMode = ColorMode.Color,
            Orientation = Orientation.Portrait,
            PaperSize = PaperKind.A4,
            Margins = new MarginSettings { Top = 20, Bottom = 20, Right = 10, Left = 10 },
            DocumentTitle = "PDF Report",
            Out = path
        };


        var objectSettings = new ObjectSettings
        {
            PagesCount = true,
            HtmlContent = htmlTemplate,
            WebSettings = { DefaultEncoding = "utf-8", PrintMediaType = true, LoadImages = true },
            HeaderSettings = { FontName = "Arial", FontSize = 9, Line = true, HtmUrl = @"C:\...\Uploads\CompanyLogo\Logo.htm" },
            FooterSettings = { FontName = "Arial", FontSize = 9, Line = true, Right = "Page [page]", Left = auditBy }
        };
        var pdf = new HtmlToPdfDocument()
        {
            GlobalSettings = globalSettings,
            Objects = { objectSettings }
        };

        _converter.Convert(pdf);

        return path;
    }

Specified path of html file in HtmUrl but image is not displaying in header Can anyone specify solution for that

Gladiator
  • 31
  • 1
  • 1
  • 5
  • check this: https://stackoverflow.com/questions/64559949/dinktopdf-including-image-in-htmlcontent – Aboulfazl Hadi Mar 20 '23 at 11:35
  • Thanks @AboulfazlHadi for replay. What i actually need is add image to header not to the content. Content case is working fine for me. – Gladiator Mar 20 '23 at 12:58

0 Answers0