I am trying to import a web page directly into PDF using th etrial Aspose.PDF. When I set breakpoints, the web page is being acquired correctly, but the PDF document is BLANK.
Here is my code...
// The address of the web URL which you need to convert into PDF format
string WebUrl = System.Configuration.ConfigurationManager.AppSettings["HostName"].ToString() + "PDFUri.aspx?DocumentId=" + DocId.ToString() + "&NarrativeType=1";
// *** Establish the request
HttpWebRequest loHttp = (HttpWebRequest)WebRequest.Create(WebUrl);
// *** Set properties
loHttp.Timeout = 10000; // 10 secs
// *** Retrieve request info headers
HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();
Encoding enc = Encoding.GetEncoding(1252); // Windows default Code Page
StreamReader loResponseStream = new StreamReader(loWebResponse.GetResponseStream(), enc);
string lcHtml = loResponseStream.ReadToEnd();
loWebResponse.Close();
loResponseStream.Close();
// Instantiate an object PDF class
Pdf pdf = new Pdf();
// add the section to PDF document sections collection
Aspose.Pdf.Section section = new Section();
//Create text paragraphs containing HTML text
Aspose.Pdf.Text text2 = new Aspose.Pdf.Text(section, lcHtml);
// enable the property to display HTML contents within their own formatting
text2.IsHtmlTagSupported = true;
// Add the text object containing HTML contents to PD Sections
section.Paragraphs.Add(text2);
pdf.Sections.Add(section);
//Save the pdf document
pdf.Save(memStream);