1

I have implemented a module where i m trying to generate a PDF.PDF is generated successfully using MVCRAZORtppdf.

But now I want to add a image on PDF as well.How to add a image on PDF. And I want to add image on controller level.

Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123
Shian JA
  • 848
  • 4
  • 15
  • 52

1 Answers1

2

Here is my solution done completely inside view:

@{
    Layout = null;
    var imagePath = Server.MapPath("~/Content/images");
    ....
}

<body>
    ....
        <img src="@imagePath\Cert_back.bmp" />
    ....
</body>

If you want to set an image in Controller, I guess you can use ViewBag to set value in imagePath variable.

However, keep in mind that you can use Razor's if-then-else statement and set value dynamically in View.

Kenan Zahirovic
  • 1,587
  • 14
  • 24