We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Performance Issue ASPOSE Word

Hi ,

I am working on ASPOSE Word API for Rendering and i checked old posts about performance as mentioned in this post ( Page to Bitmap Conversion Time Slow on Android ) i code in this manner and get following data :

Performance Test at our End:

Sample.doc ( 96 KB )
Load Time : 16 s .
1st Image Conversion Time : 30 s .
2nd Image Conversion Time : 0 s .

Sample.doc ( 1 MB )
Load Time : 31 s .
1st Image Conversion Time : 310 s .
2nd Image Conversion Time : 0 s .

Sample.doc ( 4 MB )
Load Time : 169 s .
1st Image Conversion Time : Not able to View Out of Memory currently .

I need to know max file size ASPOSE Word API take in Render for converting images of doc in Android Device and approx time it will take for different file size .

I observed increase in page numbers from actual present in doc .Kindly describe this behaviour .

Regards
Mahesh Anand
9990407589
Data Resolve Technologies

@rajnishkumar,

Thanks for your inquiry. ‘Aspose.Words for Android via Java’ has to build ‘Page Layout’ of complete Document before it can actually start exporting content to Image formats. You will notice that rendering first Page to first Image takes more time than rendering subsequent Pages to separate Images. It depends on the size and complexity of your Word document.

Roughly, Aspose.Words layouts 10 pages per second; so, the extra amount of time Aspose.Words takes to format a document into pages depends on the number of pages your Word document has. Also, please note that this process is not linear; it may take a minute to build layout of one page and may take a few seconds to process 100 pages. Put simply, the processing time and memory usage fully depend on your documents and their complexity. However, Aspose.Words does not put any limit on file size. It depends on the RAM memory size of your device.

You may try specifying ImageSaveOptions.setUpdateFields(false); to ImageSaveOptions class. It should improve time to Save your Word Document to first Image (and other remaining Images as well).

In case the problem still remains, please ZIP and attach your sample Word documents and piece of code here for testing. We will investigate the scenario further on our end and provide you more information.

Best regards,
Awais Hafeez

I Understand your view for Using ASPOSE Word API .

Here my points I Need to understand :

  • We purchase License of ASPOSE Total for Android any other Instant / Private Support we get …?
  • I need to know can we work on same document from different thread at same time ?
  • if i need to render all pages then i need to call document.getPageCount() which takes same time as render to the first image any other way to get all pages No. effectively …?
  • Is Render directly to Canvas is effective then Image Rendering …? If yes , Please specify some cons …?

Here my code i implemented in debug case :

new Thread(new Runnable() {

        @Override
        public void run() {

            String path = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "testdocs" + File.separator;
        
            File file = new File(path + "sample5_1.doc");

            try {

                startTime = System.currentTimeMillis();

                InputStream fileInputStream = new FileInputStream(file);
                Document document2 = new Document();
                document2.updatePageLayout();                  
                document = new Document(fileInputStream);

                endTime = System.currentTimeMillis();

                System.out.println("Load Time : " + ((endTime - startTime) / 1000));                

                new Thread(new Runnable() {

                    @Override
                    public void run() {

                        try {
			//comment total page get 
                            /*long startTime = System.currentTimeMillis();

                            totalPages = document.getPageCount();

                            long endTime = System.currentTimeMillis();

                            System.out.println("Total Pages : " + ((endTime - startTime) / 1000));*/

                            try {

                                for (int i = 0; i < 50; i++) {

                                    startTime = System.currentTimeMillis();

                                    ImageSaveOptions imageSaveOptions = new ImageSaveOptions(SaveFormat.JPEG);
                                    imageSaveOptions.setUpdateFields(false);
                                    imageSaveOptions.setPageIndex(i);
                                    String savePath = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "Demo" + i + ".jpeg";
                                    document.save(savePath, imageSaveOptions);

                                    endTime = System.currentTimeMillis();

                                    System.out.println("Page Load Time " + i + " " + ((endTime - startTime) / 1000));

                                }


                            } catch (Exception e) {

                                Log.d(TAG, " Page Error : " + e.getMessage());

                            }

                        } catch (Exception e) {

                            Log.d(TAG, "Total Page Error : " + e.getMessage());

                        }

                    }
                }).start();
             
            } catch (Exception e) {

                Log.d(TAG, "run: ERROR" + e.getMessage());

            }

        }
    }).start();

I am using Ubuntu 14.04 LTS .

Kindly Explain Page no difference on PC and through ASPOSE Word API .

first test with 1.2 MB doc ( 174 pages ASPOSE ) (169 Showing on PC)and total page get code is present :
Load Time : 48 s.
Total Page Time : 324 s.
First Page Time : 10 s .
then 1 s for next page and so on .

then test with same 1.2 MB doc ( 174 Pages ASPOSE ) (169 Showing on PC) but comment code for total page get :
Load Time : 48 s.
First Page Time : 325 s.
then 1 s for next page and so on .

then test with 2 MB doc (1380 pages ASPOSE )(343 Pages on PC ) and comment code
Load Time : 124 s.
First Page Time : 1392 s.
then 1 s or 2 s or 3s for next page and conversion stop after 49 pages.

Further i am testing with 5 MB doc (859 Pages showing on PC)
Load Time : 173 s .
First Page Time : Need to know (Not able to get at our end ).

I am testing on Android 5.0 API level with 1 GB RAM .

I am attaching you two files testfiles.zip (369.6 KB) of 2mb and 5 mb .

Kindly test it at your end and share logs with me .

Regards
Mahesh Anand
9990407589
Data Resolve Technologies

@rajnishkumar,

Thanks for your inquiry.

If you bought standard license then you can only post queries in the forums mentioned here. If you bought Priority Support or Enterprise Support subscriptions then you can use both Free Support Forums and Paid Support Forums. Please refer to the following page to learn about different Support models.
Consulting & Support

‘Aspose.Words for Android via Java’ is multi-thread safe as long as only one thread works on a Document at a time. It is a typical scenario to have one thread working on one Document. Different threads can safely work on different Document instances at the same time. Please note that ‘Aspose.Words for Android via Java’ supports multi-threading. Document objects are independent of each other and as long as only one thread at a time is allowed to modify a Document, multiple threads can be processing any number of Documents at the same time.

Document.updatePageLayout() and Document.getPageCount() both invoke the same routines of Layout Engine so they essentially take the same amount of time. With large documents Document.getPageCount() property can take time. However, after invoking this property, any rendering operation e.g rendering to PDF or image will be instantaneous. Alternatively, you can use Document,getBuiltInDocumentProperties().getPages() Property if you just want to get estimate number of Pages.

Any kind of rendering operation will cost the same amount of time.

This problem may occur because your non-PC environment does not have all the fonts installed which are used in the Word document that you are rendering to Image (or PDF, XPS formats etc). Please refer to following articles:

How Aspose.Words Uses True Type Fonts
How to Receive Notification of Missing Fonts and Font Substitution during Rendering

Best regards,
Awais Hafeez

Hi Awais ,

Kindly share test Result of Files Share with you .

Regards
Mahesh Anand
9990407589

@rajnishkumar,

Please check:

These results were produced by executing the following ‘Aspose.Words for Android via Java’ 17.7 code on real Android 5.1 mobile device:

License lic = new License();
lic.setLicense(licString);

Runtime runtime = Runtime.getRuntime();
long startTime = System.currentTimeMillis();

Document doc = new Document(Environment.getExternalStorageDirectory().getAbsolutePath() + "/page343.doc");

long endTime = System.currentTimeMillis();
String times = "Document Load time: " + (endTime - startTime) + " ms\n";

startTime = System.currentTimeMillis();

ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG);
options.setPageCount(1);
int pageCountDoc = doc.getBuiltInDocumentProperties().getPages();

endTime = System.currentTimeMillis();
times = "doc.getBuiltInDocumentProperties().getPages() time: " + (endTime - startTime) + " ms\n";

startTime = System.currentTimeMillis();

for (int pageCount = 0; pageCount < pageCountDoc; pageCount++)
{
    options.setPageIndex(pageCount);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    doc.save(baos, options);

    endTime = System.currentTimeMillis();
    times = times + "Image " + pageCount + " Save Time: " + (endTime - startTime) + " ms \n";
    startTime = System.currentTimeMillis();
}

DocumentBuilder builder = new DocumentBuilder();
builder.writeln(times);
builder.getDocument().save(Environment.getExternalStorageDirectory().getAbsolutePath() + "/page343-testResults.docx");

Best regards,
Awais Hafeez

Hi Awais ,

I am not able to get same Time logs with your code . I tested on this devices

  • Moto X 2nd Generation ( API level 6.0) ( 2 GB RAM ) and ,
  • Lenovo A6000 ( API level 5.0.2 ) ( 1 GB RAM ).
    Testing ASPOSE Word.zip (3.6 KB)

In this devices the conversion time of 1st image of the document is in 8 - 12 min for Document ( page 343.doc ).

Their is a difference in pageCount from document.getBuiltInDocumentProperties().getPages() and document.getPageCount() i get increase in page no. in document.getpagecount() method . why ?

Kindly explain why i am getting so much delay for 1st image conversion .

Regards
Mahesh Anand
9990407589
Data Resolve Technology

@rajnishkumar,

Yes, there is a difference in these properties. The BuiltInDocumentProperties.Pages property returns an estimate of the number of pages in the document (this page count is already written inside document by MS Word upon save). Upon calling this property, Aspose.Words does not update Page Layout and just returns what is written inside document. You can also verify this if you try to unzip any DOCX, you will see docProps\app.xml file and there is Properties -> Pages and this Pages is BuiltInDocumentProperties.Pages.

But, Document.PageCount property returns number of pages in the document as calculated by the most recent page layout algorithm of Aspose.Words. You can try to call Document.UpdatePageLayout method and then Document.PageCount property to get correct number of pages. This property is helpful to get page count of non-MS Word formats such as TXT, HTML. We also need to use Document.PageCount Property in case when you load Word document and do some modifications. Hope, this clarifies the difference between these two.

Please upgrade to Aspose.Words for Android via Java 17.8 from the following link as we have included significant performance and heap space optimizations in latest version:
https://downloads.aspose.com/words/androidjava

Best regards,

Hi Awais,

I am already using the latest "Aspose.Words for Android via Java 17.8 " JAR in Project and above Logs are generated using same JAR .

Kindly describe delay observed on conversion of 1st image of the document which is 8 - 12 min .

Regards
Mahesh Anand
9990407589
Data Resolve Technology

@rajnishkumar,

We are working over your query and will get back to you soon.

Best regards,

@rajnishkumar,

We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged the following issues in our issue tracking system.

WORDSJAND-301: related to page343.doc
WORDSJAND-302: related to sample5mb.doc

Our product team will further look into the details of these issues and we will keep you updated on the status of corrections. We apologize for your inconvenience.

Best regards,

Hi Awais ,

We are currently developing APP based on this Outputs and our Timeline is Strict .
Kindly share Status of the ISSUE.

Regards
Mahesh Anand
Data Resolve Technologies
9990407589

@rajnishkumar,

Regarding WORDSJAND-301 and WORDSJAND-302, I am afraid, we are not able to do anything about it at the moment. We have to improve the performance in the base .NET API.

  1. The difference in pageCount between document.getBuiltInDocumentProperties().getPages() and document.getPageCount() according to Java documentation is:
  • BuiltInDocumentProperties.getPages() represents an estimate of the number of pages in the document.
  • Document.getPageCount() returns the number of pages in the document as calculated by the most recent page layout operation.

Thus BuiltInDocumentProperties.getPages() can return different pages’ number.

  1. why i am getting so much delay for 1st image conversion

Aspose.Words has to build up the whole document’s layout to find out what page you are looking for and what content it has. All subsequent calls use existing layout.

  1. Java and .NET has the same behavior (slightly different numbers of course).

Also, sample5mb.doc is almost twice the size of page343.doc so it takes longer time.

We apologize for your inconvenience.