string url = HttpContext.Current.Request.Url.AbsoluteUri;
string WebUrl = url; //"http://localhost:53352/Login.aspx";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(WebUrl);
request.Timeout = 10000;
HttpWebResponse localWebResponse = (HttpWebResponse)request.GetResponse();
Encoding encoding = Encoding.GetEncoding(1252);
StreamReader localResponseStream = new StreamReader(localWebResponse.GetResponseStream(), encoding);
Pdf pdf = new Pdf();
pdf.HtmlInfo.ExternalResourcesBasePath = "http://localhost:53352/";
Section section = pdf.Sections.Add();
Text text2 = new Text(section, localResponseStream.ReadToEnd());
text2.IsHtmlTagSupported = true;
text2.IfHtmlTagSupportedCssWinsOnFirstLevelChildren = true;
text2.IsAlignedByWord = true;
text2.IsFitToPage = true;
text2.IsKeptWithNext = true;
section.Paragraphs.Add(text2);
pdf.Save(@"D:\HtmlToPdf.pdf");
localWebResponse.Close();
localResponseStream.Close();
string WebUrl = url; //"http://localhost:53352/Login.aspx";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(WebUrl);
request.Timeout = 10000;
HttpWebResponse localWebResponse = (HttpWebResponse)request.GetResponse();
Encoding encoding = Encoding.GetEncoding(1252);
StreamReader localResponseStream = new StreamReader(localWebResponse.GetResponseStream(), encoding);
Pdf pdf = new Pdf();
pdf.HtmlInfo.ExternalResourcesBasePath = "http://localhost:53352/";
Section section = pdf.Sections.Add();
Text text2 = new Text(section, localResponseStream.ReadToEnd());
text2.IsHtmlTagSupported = true;
text2.IfHtmlTagSupportedCssWinsOnFirstLevelChildren = true;
text2.IsAlignedByWord = true;
text2.IsFitToPage = true;
text2.IsKeptWithNext = true;
section.Paragraphs.Add(text2);
pdf.Save(@"D:\HtmlToPdf.pdf");
localWebResponse.Close();
localResponseStream.Close();