Hi,
I am developing a code based on the sample code given by you. The code is as follows.
string WebUrl = HttpContext.Current.Request.Url.ToString(); // http://localhost:8080/sales.aspx
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(WebUrl);
request.Timeout = 10000; // 10 secs
HttpWebResponse localWebResponse = (HttpWebResponse)request.GetResponse();
Encoding encoding = Encoding.GetEncoding(1252);
StreamReader localResponseStream = new StreamReader(localWebResponse.GetResponseStream(), encoding);
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();
Aspose.Pdf.Generator.Text text = new Aspose.Pdf.Generator.Text(section, localResponseStream.ReadToEnd());
text.IsHtmlTagSupported = true;
section.Paragraphs.Add(text);
pdf.HtmlInfo.ImgUrl = “Images”;
pdf.Save(@“C:\DirectHTML2pdf.pdf”);
localWebResponse.Close();
localResponseStream.Close();
It always throwing the errors at pdf.Save. The error is object reference not set to instance of an object.
An early reply with working code is highly appreciated.
Thanks,
Sai