Free Support Forum - aspose.com

Pdf to html conversion fails- msg="Comparison method violates its general contract!"

I’m using Aspose.pdf.10.0.0-jdk6. When I try convert the attached pdf to html, it fails with the stacktrace below.


The code to convert is simple and works for other pdfs, but not for this particular pdf.
static void pdfToHtml(String name, byte[] bytes, boolean ppt) throws IOException {
ByteArrayInputStream inStream = new ByteArrayInputStream(bytes);
com.aspose.pdf.Document doc = new com.aspose.pdf.Document(inStream);
int pageCount = doc.getPages().size();
logger.info(String.format(“pdfToHtml name=%s, pageCount=%d”, name, pageCount));
com.aspose.pdf.HtmlSaveOptions saveOptions = new com.aspose.pdf.HtmlSaveOptions();
saveOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats;
saveOptions.setSplitCssIntoPages(false);
String suffix = ppt? “-ppttopdf.html”: “-frompdf.html”;
String docName = outputDirectory + “\” + name + suffix;
doc.save(docName, saveOptions);
}

StackTrace:
[THREAD=main] 2015-03-12 16:07:49 INFO AsposeTest:482 - pdfToHtml name=Journal of Chemistry, pageCount=13
[THREAD=main] 2015-03-12 16:08:05 WARN Utils:28 - java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeHi(TimSort.java:868) at java.util.TimSort.mergeHi(TimSort.java:868)
at java.util.TimSort.mergeAt(TimSort.java:485)
at java.util.TimSort.mergeForceCollapse(TimSort.java:426)
at java.util.TimSort.sort(TimSort.java:223)
at java.util.Arrays.sort(Arrays.java:727)
at com.aspose.pdf.internal.p302.z1.m1(Unknown Source)
at com.aspose.pdf.internal.p44.z21.m12(Unknown Source)
at com.aspose.pdf.internal.p44.z21.m1(Unknown Source)
at com.aspose.pdf.internal.p44.z3.m1(Unknown Source)
at com.aspose.pdf.internal.p42.z1.m2(Unknown Source)
at com.aspose.pdf.internal.p42.z1.m3(Unknown Source)
at com.aspose.pdf.internal.p42.z5.m4(Unknown Source)
at com.aspose.pdf.internal.p39.z1.m1(Unknown Source)
at com.aspose.pdf.internal.p39.z1.m3(Unknown Source)
at com.aspose.pdf.internal.p39.z1.m1(Unknown Source)
at com.aspose.pdf.internal.p39.z1.m2(Unknown Source)
at com.aspose.pdf.internal.p39.z1.m1(Unknown Source)
at com.aspose.pdf.internal.p38.z3.m1(Unknown Source)
at com.aspose.pdf.internal.p217.z7.m1(Unknown Source)
at com.aspose.pdf.internal.p217.z7.m1(Unknown Source)
at com.aspose.pdf.z77.m1(Unknown Source)
at com.aspose.pdf.ADocument.save(Unknown Source)
at com.aspose.pdf.Document.save(Unknown Source)
at asposetest.AsposeTest.pdfToHtml(AsposeTest.java:488)
at asposetest.AsposeTest.doCustomHtmlConversion(AsposeTest.java:273)
at asposetest.AsposeTest.doFile(AsposeTest.java:72)
at asposetest.AsposeTest.doDirectory(AsposeTest.java:818)
at asposetest.AsposeTest.doDirectory(AsposeTest.java:829)
at asposetest.AsposeTest.main(AsposeTest.java:897)

Hi Andy,

Thanks for your inquiry. I have tested your scenario with your shared document using Aspose.Pdf for Java 10.0.0 and managed to observe the reported exception. For further investigation, I have logged an issue in our issue tracking system as PDFNEWJAVA-34750 and also linked your request to it. We will keep you updated via this thread regarding the issue status.

Please feel free to contact us for any further assistance.

Best Regards

The issues you have found earlier (filed as PDFNEWJAVA-34750) have been fixed in Aspose.Pdf for Java 10.4.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.