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

Free Support Forum - aspose.com

Opening Html document throws Unable to cast object of type '.' to type '.'

Trying to open the attached html document with Aspose.Pdf vers 11.0.0 fails and throws an error Unable to cast object of type ‘.’ to type ‘.’

Here is the sample code :

var inp = “page1.html”;

var outp = “page1.pdf”;

HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();

htmlLoadOptions.PageInfo.Margin.Bottom = 10;

htmlLoadOptions.PageInfo.Margin.Top = 10;

htmlLoadOptions.PageInfo.Margin.Left = 10;

htmlLoadOptions.PageInfo.Margin.Right = 10;

htmlLoadOptions.PageInfo.Height = 840;

htmlLoadOptions.PageInfo.Width = 750;

htmlLoadOptions.PageInfo.IsLandscape = false;

var doc = new Document(inp, htmlLoadOptions);


Hi Pnocera,

for using our API’s.

have tested the scenario and I am able to notice the same problem. For the sake
of correction, I have logged this problem as PDFNEWNET-39972 in
our issue tracking system. We will further look into the details of this
problem and will keep you updated on the status of correction. Please be
patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFNET-39972) have been fixed in Aspose.PDF for .NET 19.11.