We are converting HTML to PDF using the new DOM method, and we are also adding HTML to the header via an HTML Fragment (in a new Document as a workaround for an earlier reported bug (PDFNEWNET-38335)). All was working successfully in version 10.1 of Aspose.PDF. Now that we have upgraded to 10.2, we are getting an error when we try to Save the Document after the HTMLFragment was added:
System.ArgumentOutOfRangeException was unhandled
HResult=-2146233086
Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source=mscorlib
Note that this only happens when the output document has more than one page. If there is only one page, everything works successfully. I've also stepped over the addition of the header element, and everything else works successfully, so whatever's going wrong is happening in the Aspose objects in that block of code.
By removing the code to a separate project and changing the reference between the two versions of the DLL, I've verified that the problem is only in the new version of the product. I have attached a ZIP with my test project, sample input and a TXT document with the full stack trace of the error. I had to delete the bin and obj directories due to size restriction, so let me know if you need anything else.
My only workaround, it appears, is to roll back to 10.1.