Free Support Forum - aspose.com

Exceptions binding to HTML (Aspose website)

var pdf = new Pdf();
pdf.BindHTMLFromUrl("http://www.aspose.com/categories/default.aspx");
pdf.Save(@"c:\TestData\ConvertedUrlPdf.pdf");

raises this exception:

System.ArgumentException: Invalid image file type for imageC:/projects/.../Out//WebResource.axd?d=efTFsIgYoJWpjVy3Jw3-NA2&t=633417631083125000
Parameter name: Unknown.

If I save the above web page locally as C:\TestData\AsposePage.htm, I get another exception

var pdf = new Pdf();
pdf.BindHTMLFromUrl(@"C:\TestData\AsposePage.htm");
pdf.Save(@"c:\TestData\ConvertedUrlPdf.pdf");

System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length

Hi,

I have tested your code and was able to reproduce the first error. I have logged this as PDFNET-4698 in our issue tracking system. We will try our best to resolve this as soon as possible.

When you save the page locally then you should use th BindHTML method and not BindHTMLFromUrl. This way you will not have any problems.

Thanks.