Images not displaying
I am using ViewAsPdf and I can't seem to display an image. This is in my razor file:
<img src="../Images/asd.jpg" />
I am using Rotativa.AspNetCore 1.2.0 beta
I also can't seem to the view as an image.
Hi, do you fixed?
I also same problem..
View.cshtml

Controller.cs
public IActionResult PreviewPDF()
{
string webRootPath = _environment.WebRootPath;
ViewData["imgPath"] = Path.GetFullPath(Path.Combine(webRootPath, "img"));
return View();
}
Rotativa.AspNetCore Version is same. I tried to various ways but images not displaying.
How solve this problem..?
This is an old issue, but in case anyone stumbles upon this: by default Rotativa sets the base URL, which interferes with relative paths. In the latest version, you can disable this:
return new ViewAsPdf("MyView", setBaseUrl: false);
If anyone can verify if this fixes the problem, this issue could be closed.