开发者

ASP.NET MVC Render View to String

开发者 https://www.devze.com 2022-12-23 14:33 出处:网络
I\'m currently using NVelocity to render some email templates. I\'m curious how I can do this with the standard ASP.NET MVC view engine i.e. render a view as a string.

I'm currently using NVelocity to render some email templates.

I'm curious how I can do this with the standard ASP.NET MVC view engine i.e. render a view as a string.

Basically I want to pass get the string result of a model binded view and pass开发者_JAVA技巧 this to iTextSharp to generate a PDF.

Thanks. Ben


You have a PDF generator that takes html as an arg to generate a pretty PDF?

Look at this blog entry for how to capture a rendered view as a string.


You can use a ContentResult to return Content(yourString, "text/plain"); but you just build the string in the ContentResult method and use no View.

0

精彩评论

暂无评论...
验证码 换一张
取 消