0

I have an issue with ASPOSE.PDF when converting pdf to doc/docx.

    Document pdf2wordDocument = new Document();

While initializing the Document object as soon as my project runs helps ( it reduces the process time with 15-25sec ) the conversion is still very slow.

    pdf2wordDocument = new Document(outputDocDir + fileNameWithExtension); // this takes 15-25 sec - FIXED with initialization of Document object at startup
    String documentExtension = saveOptions.getFormat() == 0 ? "doc" : "docx";

    String outputFile = outputDocDir + fileName + "." + documentExtension;
    log.info("New file to be converted -> " + outputFile + "  Converting...");
    pdf2wordDocument.save(outputFile, saveOptions); // This takes 65-75 seconds
    pdf2wordDocument.close();

I tried both increasing the memory in MEMMIN and MEMMAX and removing the restriction all together – this has no effect on the conversion speed.

Both delays are not present when I compiled a standalone app that only converts the files. However, when implemented in the project there is a huge delay of over a minute for 4-page PDF (the limit of the Trial version of the library)

Does anyone have a clue as how to speed up the pdf2wordDocument.save()?

i.svirchev
  • 69
  • 6
  • We believe that you have posted a similar inquiry in the official Aspose.PDF support forum. We have responded to you and you can please provide your feedback in the reply there (https://forum.aspose.com/t/pdf-to-doc-docx-extremely-slow-at-document-save/231892). – Asad Ali Jul 06 '21 at 18:35
  • @AsadAli Thank you! We managed to find the root cause. – i.svirchev Jun 27 '22 at 08:00

1 Answers1

0

We accidentally found and fixed the issue with the slow conversion.

It was a -Djava.compiler=NONE passed into the start script of our project.

As far as I understand the parameter disables the JIT compiler (enabled by default) which improves performance.

As per: https://www.ibm.com/docs/en/sdk-java-technology/7.1?topic=compiler-jit-overview

Disabling the JIT compiler is not recommended except to diagnose or work around JIT compilation problems.

i.svirchev
  • 69
  • 6