Closed cnceniza closed 6 years ago
Please check this issue . When I give absolute path to img tag it works as expected:
<img src='http://localhost:5000/guide.jpg
If you need relative path please check issues on wkhtmltopdf page.
Thank you! It worked! Now, I only need to configure environment variables
you can use HtmlAgilityPack to fix this issue
var htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(htmlContent);
foreach (var node in htmlDoc.DocumentNode.SelectNodes("//img"))
{
var src = node.Attributes[@"src"].Value;
if (src.StartsWith("/"))
node.SetAttributeValue("src", baseUrl + src);
}
var newHtml = htmlDoc.DocumentNode.WriteTo();
.net core version: 1.0.4 dinktopdf: 1.0.8
I am trying to add an
<img>
but it seems it does not work. I already haveapp.UseStaticFiles();
I added the image in mywwwroot
folderI also tried it on 2.0.2 version of dotnet I already have the
.dlls
in my root folderA snippet of my code
How can I add an image to my page then convert it to pdf?
Cheers