PDF not generating - processParagraphs() hangs

Hi,
We are using Aspose PDF for Java (23.8), but for some instances it fails to generate the PDF.
I know you will be asking code to reproduce it, but we ourselves are not able to reproduce the issue in lower environment. It happens only in PROD. Below are the details, please check once and see if similar issue raised earlier or is there any solution you can provide based on your experience.

  1. PDF generation works fine most of the time, but sometime for some cases PDF generation never complete.
  2. Whenever that happens, it start high utilization of utilizing system resources (cpu and memory), which eventually create the problem for whole application.
  3. Details of how we are using the code -
  • Creating an instance of com.aspose.pdf.Document
    pdfDocument = new Document();

  • once everything is added to document we have below code -
    log.info(“Starting Process Paragraphs”);
    pdfDocument.processParagraphs();
    log.info(“End Process Paragraphs”);
    pdfDocument.optimize();
    log.info(“End Optimize PDF”);
    pdfDocument.setPageLayout(PageLayout.OneColumn);
    log.info(“End set layout”);
    pdfDocument.save(pdfFile);
    log.info(“PDF Saved”);
    pdfFile.close();
    FontRepository.clear();

  • For some instances, whenever issue happens, we only see log for “Starting Process Paragraphs” and after that it hangs, it never complete it.

  1. Even though multiple retry of generating the PDF for same case, it never completes.
  2. The structure of PDF is similar to all other which are generating fine.
  3. We tried to check the content of PDF and removed all alphanumeric characters, removed regular special char (like ,.:'"[]{}\-()*&#$ etc.), than after that some special UTF 8 char was still there, like below.

óó$‘–’–’–––––––’’’––––––––’’–’–––––––’’’’’–––––––’’’í’’óó’ñ’‘‘ÓáÁ’;‘ñ’’’’’’Á’’$‘óó$’
’––’’––’’–––––––––’–’’–––––––’óóñÓáÁñ’**óó

  1. When we added same characters in lower environment with all other content, and tried to generate the PDF, it worked fine.
  2. We have a code snipped to take care of UTF 8 char like below
    TextEditOptions teo = new TextEditOptions(false);
    teo.setLanguageTransformationBehavior(com.aspose.pdf.TextEditOptions.LanguageTransformation.ExactlyAsISee);

Could you please with this situation and suggest what can be done?
We don’t have a sample code to reproduce the issue as we are also not able to reproduce it , but I have shared the details as much as possible. Please let me know if you are looking for anything else on this.

@amit.rathi

Would you please try using 24.8 version of the API and see if it resolves the issue that you are facing? There are a lot of improvements in the latest version of the API in terms of memory consumption. In case you still face this behavior, please let us know. We will log an investigation ticket and share the ID with you.

Hi Asad,
We have been facing this issue since long (from version 20, 21). This specifically doesn’t look like a pure memory consumption issue.
I would like to request to you please open a ticket and see if your tech team can find some insight into this.
Using a newer version (24.8) and pushing it to our PROD environment will take few months as that need to be planned with other releases. It might need some code changes too.
Appreciate your help with raising a ticket for same.

@amit.rathi

We will be generating a ticket in our issue tracking system shortly and you will receive a notification when its attached to this thread.

@amit.rathi

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFJAVA-44369

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.