We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML to PDF giving exception!


I was trying the .net version of aspose.pdf, and I was trying to render an html page (google page in this case) to .pdf. But when I use pdf.save, it gives me an "Object not set to an instance of an object."

Here's my code, am I doing something wrong?

StreamReader localResponseStream = File.OpenText(inputFileName);

// Instantiate an object PDF class

Pdf pdf = new Pdf();

// add the section to PDF document sections collection

Aspose.Pdf.Section section = pdf.Sections.Add();

//Create text paragraphs containing HTML text

Aspose.Pdf.Text text2 = new Aspose.Pdf.Text(section, localResponseStream.ReadToEnd());

// enable the property to display HTML contents within their own formatting

text2.IsHtmlTagSupported = true;

// Add the text object containing HTML contents to PD Sections


// Specify the URL which serves as images database

//pdf.HtmlInfo.ImgUrl = "http://en.wikipedia.org/";

//Save the pdf document




Hello Sérgio,

Thanks for using our products.

The HTML to PDF conversion feature is in Beta phase and our development team is working hard to make it stable. Meanwhile I have tested the scenario and I am able to notice this problem. The problem is already logged in our Issue tracking system as PDFNET-15666. Once we have some definite news regarding its resolution, we would be pleased to update you with the status of correction. We apologize for your inconvenience.