Below is the code i use to read a web page, i can read from an outer web page but i need to read the local html class.
Document document = new Document();
try
{
PdfWriter.GetInstance(document, new FileStream("C:\\teklif.pdf", FileMode.OpenOrCreate));
document.Open();
WebClient wc = new WebClient();
string HtmlText = wc.DownloadString("http://localhost:60972/Reports/Index");
Response.Write(HtmlText);
List<IElement> HtmlArrayList = HTMLWorker.ParseToList(new StringReader(HtmlText), null);
for (int k = 0; k < HtmlArrayList.Count; k++)
{
document.Add((IElement)HtmlArrayList[k]);
}
document.Close();
}
catch
{
}
return View();
By this way, i can't already access the localhost because of the active directory restriction.
What i need is something like this.
string HtmlText = wc.DownloadString("Reports/Index.cshtml");
Or is the way sending the html object should be via AJAX call?
Tia.