I want to generate HTML of my View to generate PDF document. It has styles and scripts applied when it opens in browser. I tried the following code but it only gives the ht
I might as well post my comment as an answer...
Razor/ASP.Net will only generate source, not execute client-side scripts. You need to use something that emulates a web browser to turn the client-side script into a rendered PDF.
That means it needs to understand both script and styling (i.e. just like a browser).
There are several commercial products out there, but I have personally used Essential Objects PDF converter to generate views direct to PDF. It has a built-in Javascript engine, so looks just like it will in the browser.
Please note these products are very complex (as they include complete Browser rendering engines), so most will required paid licences (for commercial use at least).
Note: I am in no way associated with Essential Objects. This is purely opinion based on actual use of that product.