rdvojmoc / DinkToPdf

C# .NET Core wrapper for wkhtmltopdf library that uses Webkit engine to convert HTML pages to PDF.
MIT License
1.09k stars 417 forks source link

Adding footer with htmlurl property referring a html file with trying different kind of relative paths crashes application with throwing no exception. #120

Open krsandhya opened 4 years ago

krsandhya commented 4 years ago

Adding footer with htmlurl property of dlinkpdf , referring to a html file with trying different kind of relative paths crashes application with throwing no exception. Also how do i add html page of one project in another project were actually pdf related query are written. I tried to place the file in same folder as the code in but still it fails.

var page = new ObjectSettings()
            {
                WebSettings = { DefaultEncoding = "utf-8" },
                PagesCount = true,

                FooterSettings = { Left = $"Page Num:[page]  {footerData}", Line=true,
                                       FontName = "Calibri", FontSize = 10, HtmUrl=@"..\test.html" },
                HtmlContent = item,
            };
            return page;
harrinson-gutierrez commented 3 years ago

Working for me Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), $"Razor/Templates/ReportHeader.html")

but does not recognize cshtml files, only html

image