Performance problems with MailMerge parsing and file format manipulation

Hi there,

the company I work for, is interested to buy an aspose.words Developer OEM license. In our case, we would like to buy the Android version. We need to use the API to parse docx documents filled by several mergefields (text and images) and then we need to convert manipulated docx files to pdf format.

We made several tests using the trial version (without appling any license) and we found out some performance problem. In my MainActivity I wrote this code:

Log.d(TAG, "OPERATION STARTED!");

long tStart = System.currentTimeMillis();
Document doc = new Document(Environment.getExternalStorageDirectory() + "/test/99000001V.docx");
long tEnd = System.currentTimeMillis();
Log.d(TAG, "Second elapsed creating document: " + (tEnd - tStart) / 1000.0);

doc.getMailMerge().setTrimWhitespaces(false);
tEnd = System.currentTimeMillis();
Log.d(TAG, "Second elapsed getMailMerge().setTrimWhitespaces(): " + (tEnd - tStart) / 1000.0);

doc.getMailMerge().execute(new DocxMailMergeDataTable());
tEnd = System.currentTimeMillis();
Log.d(TAG, "Second elapsed getMailMerge().execute(): " + (tEnd - tStart) / 1000.0);

doc.save(Environment.getExternalStorageDirectory() + "/test/output.pdf");
tEnd = System.currentTimeMillis();
Log.d(TAG, "Second elapsed save(): " +(tEnd - tStart) / 1000.0);

Log.d(TAG, "OPERATION COMPLETED!");
Where DocxMailMergeDataTable is a IMailMergeDataSource implementation.

Running the code the output is this:

MainActivity: OPERATION STARTED!
MainActivity: Second elapsed creating document: 5.97
MainActivity: Second elapsed getMailMerge().setTrimWhitespaces(): 5.982
MainActivity: Second elapsed getMailMerge().execute(): 161.667
MainActivity: Second elapsed save(): 191.94
MainActivity: OPERATION COMPLETED!
We would like to ask you what are the limitations of using the no-licensed version and if the registered times can be improved by buing a complete license. In our case, we need that the entire process could be completed in less then 5 second. Is that possibile?

Thanks for your help.
Best regards.

@fedeox,

Performance of Aspose.Words for Android via Java API depends upon the complexity of your document and the number of pages it contains. If you want to test ‘Aspose.Words for Android via Java’ without the evaluation version limitations, you can also request a 30-day Temporary License. Please refer to How to get a Temporary License and the following article:

In case the problem still remains, please ZIP and upload your simplified input Word document (you are getting this problem with) and Android App (source code without compilation errors) here for testing. We will the investigate the issue on our end and provide you more information.

Hi @awais.hafeez,

thank you for your response.

I made some little modification to my source code, now the registered performance is better but not acceptable yet.

MainActivity: elapsed seconds creating document: 5.49
MainActivity: elapsed seconds getMailMerge().setTrimWhitespaces(): 5.502
MainActivity: elapsed seconds getMailMerge().execute(): 9.124
MainActivity: elapsed seconds save(): 36.199

Seems that the major latency problems occurs during the document creation and saving.

In your opinion, is it possible that the evaluation version had some forced delay and the passage to a licensed version could fix them?

If you want to investigate the issue, theese are my Android app and my Word document:
src.zip (97.8 KB)
document.zip (41.5 KB)

@fedeox,

After an initial test with the licensed latest version of Aspose.Words for Android via Java i.e. 19.4, we were unable to reproduce this issue on our end. We would suggest you please upgrade to the latest version of Aspose.Words for Android via Java. Hope, this helps.

We used the following simple code for testing:

Document doc = new Document(Environment.getExternalStorageDirectory().getAbsolutePath() + “/99000001V.docx”);
doc.save(Environment.getExternalStorageDirectory().getAbsolutePath() + “/JAND-19.4.pdf”);

The document load time we observed on a physical Android device is: 991 milliseconds
While saving to PDF took only 1996 milliseconds on our end.

However, the code you provided causes the following exception

java.lang.NullPointerException: Attempt to invoke virtual method 'double com.aspose.words.internal.zzM0.getWidthPoints()' on a null object reference

There is no such forced delay limitation even if you use evaluation copy of Aspose.Words for Android via Java. Please get a temporary license and try on another physical Android device.

1 Like