Adithya Baddula
Adithya Baddula

Reputation: 95

Return Pdf Docs from Controller in ASP.NET Core MVC

I tried to get Pdf Docs from my IActionResult method using APIs like RazorPdf,MvcPdfActionResult,PerfectPdf... But none is working for me. I am Developing an Application in ASP.NET Core MVC.

Are there any supported APIs for generating Pdfs from Controller Actions....?

Upvotes: 0

Views: 853

Answers (1)

Adithya Baddula
Adithya Baddula

Reputation: 95

MvcPdfActionResult worked for me with... I just had to change the ViewName.

Instead of passing it directly, I tried giving it's relative path like ~/Views/PdfView.cshtml.

The actual code looks like this...

return new PdfActionResult("~/Views/PdfView.cshtml", modelobject)

Upvotes: 1

Related Questions