An Exception thrown while saving a pdf into HTML format

Hi

I am using Aspose PDF 17.9 to convert PDF files into HTML format
Here is my code for test:

String fileName = "425_.pdf";
Document doc = new Document("custom/input/pdf/" + fileName);
new File("custom/output/pdf/" + fileName + "/").mkdirs();

for (int page = 1; page <= doc.getPages().size(); page++) {
	System.out.println("@@@ converting " + page);
	Document pageDoc = null;
	pageDoc = new Document();
	pageDoc.getPages().add(doc.getPages().get_Item(page));

	pageDoc.getPageInfo().setMargin(new MarginInfo(0, 0, 0, 0));

	HtmlSaveOptions htmlSaveOps = new HtmlSaveOptions();
	htmlSaveOps.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
	htmlSaveOps.FontSavingMode = HtmlSaveOptions.FontSavingModes.AlwaysSaveAsWOFF;
	htmlSaveOps.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
	htmlSaveOps.LettersPositioningMethod = LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
	htmlSaveOps.setSplitIntoPages(false);
	htmlSaveOps.setPreventGlyphsGrouping(true);

	final StringBuilder htmlBuffer = new StringBuilder();
	htmlSaveOps.CustomHtmlSavingStrategy = new HtmlSaveOptions.HtmlPageMarkupSavingStrategy() {
		@Override
		public void invoke(HtmlPageMarkupSavingInfo htmlSavingInfo) {
			try {
				htmlBuffer.append(IOUtils.toString(htmlSavingInfo.ContentStream, "utf8"));
			} catch (Exception e) {
				e.printStackTrace();
			} finally {
				IOUtils.closeQuietly(htmlSavingInfo.ContentStream);
			}
		}
	};
	String outHtmlFile = "SomeUnexistingFile.html";
	pageDoc.save(outHtmlFile, htmlSaveOps);

	IOUtils.write(htmlBuffer.toString().getBytes("UTF-8"),
			new FileOutputStream("custom/output/pdf/" + fileName + "/" + page + ".html"));

}

The exception will be thrown like this

Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
	at java.util.TimSort.mergeHi(TimSort.java:895)
	at java.util.TimSort.mergeAt(TimSort.java:512)
	at java.util.TimSort.mergeCollapse(TimSort.java:437)
	at java.util.TimSort.sort(TimSort.java:241)
	at java.util.Arrays.sort(Arrays.java:1512)
	at com.aspose.pdf.internal.p776.z1.sort(Unknown Source)
	at com.aspose.pdf.internal.p184.z20.m13(Unknown Source)
	at com.aspose.pdf.internal.p184.z20.m1(Unknown Source)
	at com.aspose.pdf.internal.p184.z3.m1(Unknown Source)
	at com.aspose.pdf.internal.p182.z2.m1(Unknown Source)
	at com.aspose.pdf.internal.p179.z1.m1(Unknown Source)
	at com.aspose.pdf.internal.p179.z1.m3(Unknown Source)
	at com.aspose.pdf.internal.p179.z1.m1(Unknown Source)
	at com.aspose.pdf.internal.p179.z1.m1(Unknown Source)
	at com.aspose.pdf.internal.p179.z1.m1(Unknown Source)
	at com.aspose.pdf.internal.p178.z3.m1(Unknown Source)
	at com.aspose.pdf.internal.p158.z9.m1(Unknown Source)
	at com.aspose.pdf.z93.m1(Unknown Source)
	at com.aspose.pdf.z93.m1(Unknown Source)
	at com.aspose.pdf.ADocument.save(Unknown Source)
	at com.aspose.pdf.Document.save(Unknown Source)

The PDF file:
https://1drv.ms/b/s!AjZYjGcEAKU_g_JumsNfTQyTMrM4TA

I also uploaded the file which may cause this issue.
Please check the file and this issue, thank you~

Craig

@craig.w.su,

We managed to replicate the said error in our environment. It has been logged under the ticket ID PDFJAVA-37170 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

Hello, has PDFJAVA-37170 been fixed in the latest Aspose PDF for Java? We are hitting this as well.

@chris747

Thank you for getting back to us.

We are afraid PDFJAVA-37170 is still unresolved owing to previously logged and critical tickets. However, we have recorded your concerns and will let you know once any update will be available in this regard.