HTML to PDF Direct

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);

Hello Thomas,

Thanks for your interest in our products.

I have tested the scenario with Aspose.Pdf for .NET 5.3.0 while using the same code snippet that you have shared and I am unable to notice any problem. For the sake of testing, I have provided the link of www.aspose.com to convert its contents into PDF. In fact the formatting of the contents inside resultant PDF is not that perfect because the source website is quite complex and Aspose.Pdf for .NET currently only supports simple websites. Please take a look over the attached PDF document that I have generated.

Can you please share which website you are trying to convert and which version of product you are using ? We are really sorry for this inconvenience.