Free Support Forum - aspose.com

Convert HTML to PDF using Aspose.PDF for .NET - System.IndexOutOfRangeException was caught

Hi,


I am facing issue with new version of aspose.pdf 10.5.0

I need to add header footer and image with Html.

same code -

* Define MemStream
* set the licence
1. //Adding header and footer to pdf.

2. byte[] arr = Encoding.UTF8.GetBytes(HtmlPage); // This is the html page

3. Stream stream = new MemoryStream(arr); // converting byte array into stream
4. pdf.BindHTML(stream, “”);
5. pdf.Save(memStream); // Blowing at this point,



System.IndexOutOfRangeException was caught
HResult=-2146233080
Message=Index was outside the bounds of the array.
Source=Aspose.Pdf
StackTrace:
at . . (Int32 )
at . . (Pdf , Image )
at . . (Pdf , Segment , Single )
at . . (Pdf , Section , Table , Row , Cell , Text , , , Boolean )
at . . (Pdf , Section , HeaderFooter , Table , Row , Cell , Text , , , Boolean )
at . . (Pdf , Section , Table , Row , Cell , , )
at . . (Pdf , Section , Table , Row , , )
at . . (Pdf doc, Section currentPart, HeaderFooter hf, Table table, assignInfo, useType, Boolean isFirst, & breakTableNextPart)
at . . (Pdf , Section , HeaderFooter , , Boolean )
at . . (Pdf , Section , , Int32 )
at . . (Pdf , Section , )
at . . (Pdf )
at . . ( , Pdf )
at Aspose.Pdf.Generator.Pdf.Save(Stream stream)

Hi Raj,


Thanks for contacting support.

It appears that you are facing an issue while converting HTML file to PDF format. Can you please share the resource file, so that we can test the conversion in our environment. We are sorry for this inconvenience.