asp.net mvc - Get Document OuterHTML of MVC Application in C# -


We need to export the whole page of the MVC application for PDF for that purpose, so that all the HTML content (like dynamic Content too)

We use the following code to get the content of the page

  string content = file. Read All Lessons (Path);  

but This will provide only static content on the page (i.e. this page returns the source code).

Then tried the following code but it also gives static content

  // WebClient object web client client = new WebClient (); // Recover the resource as a stream Stream Data = Client OpenRaid (new URI ("xxxx.html"); // Get Stream Streamer Reader = New StreamerDeader (Data); String htmlcontent = reader.ReadToEnd ();  

So I have to get the external HTML of the document using C # using any third party DLL . I went so many links and updated everyone like the Web Browser Control and got the content.

I do not think how useful it will be to our application. Our application is MVC4. We need to export the NITR page to PDF so that we need the content of HTML (dynamic content too)

I get the HTML code in the document to get the following code in your MVC application How to use

  mshtml.HTML document document = msp.HTML document as webBrowser1.Document.DomDocument; String html = doc.documentElement.outerHTML;  

or

  var documentationAsHMT document3 = (mshtml.IHTMLDocument3) webBrowser.Document.DomDocument; Stringreader sr = new string reader (documentAsihtml document 3.documentElement.outerHTML); Htmldoc.Load (sr)  

Any help on this.

You have not mentioned what the purpose of PDF is. This page is most likely to download visitors. If this is true, then maybe you can use this way, you can face the problem with not having access to the entire page server side.


Comments