DinkToPdf
DinkToPdf copied to clipboard
img and embed tags with svg extension does not load
SVG format images are not converted to PDF. Other image formats such as .png and .jpg load correctly, but .svg loads in HTML if used in a browser, but is not rendered in PDF.
Exptected result (svg and jpg are loaded):
DinkToPdf result (only the jpg image is loaded):
[HttpGet]
[Route("pdf-bug")]
public IActionResult Bug()
{
var html = @"
<html>
<head></head>
<body>
<img src='https://www.flaticon.com/svg/static/icons/svg/784/784558.svg' height='30px'>
<img src='https://img-authors.flaticon.com/freepik.jpg' height='30px'>
</body>
</html>";
var doc = new HtmlToPdfDocument()
{
GlobalSettings =
{
ColorMode = ColorMode.Color,
Orientation = Orientation.Portrait,
PaperSize = PaperKind.A4,
DocumentTitle = "Bug"
},
Objects =
{
new ObjectSettings()
{
HtmlContent = html
}
}
};
byte[] file = _converter.Convert(doc);
return File(file, "application/pdf");
}
@isabella-riquetti How did you solve it ,thax
Hi Team,
Any solution on loading the svg files in the pdf?
Thanks In Advance