Aspose Words Slow on first print

I am using Aspose Words for .net version 17.3. I am using it in a windows application and the initial “Document.Print()” call is slow (5-20 seconds). Any calls after that are done in 3 seconds or less.


I have tried calling “document.UpdatePageLayout” before calling print but it doesn’t help.

I also noticed that if I export the file to PDF first, the export is fast (1-2 seconds) but the first print after the export still take 5-20 seconds.

Please advise on a possible solution. Attached is the document I am using to print.

Hi Marc,


Thanks for your inquriy. Please share your sample code here as well, it will help us to replicate your reported issue and address it accordingly.

Best Regards,

We actually recreated it by just making a simple windows application with vb.net. Create a blank Word document and include it in your project. Then put the following in the load. Also please note that I tried also pulling the report file as a file stream via an embedded resource but that didn’t make any difference. Either way it takes 15-20 seconds the first time and 3 seconds each time there after. Also we tried printing to an HP and a Lexmark printer and both had the same result. We also tried running this on different machines and had the same result. Please advise.


Dim
doc As Document
 doc = New Document(“blank.docx”)
doc.UpdatePageLayout()
doc.Print()

Hi Marc,


Thanks for sharing additional information. We have tested the scenario at our end with your above shared document and noticed that first print call is taking around 8-7 seconds, whereas each subsequent call is taking around 2 seconds. We have logged a ticket WORDSNET-15162 in our issue tracking system for further investigation and rectification. We will keep you updated about the issue resolution progress within this forum thread.

Best Regards,

Hi Marc,


Thanks for your patience. We have investigated the issue and would like to update you that it is by design that first print call takes slightly more time than subsequent calls. When first time Print method is called, layout is built and printer parameters are cached. So for the next times when document is printed, we use already built layout and printer properties that are stored in the local variables. Hopefully it helps to understand the scenario.

Please feel free to contact us for any further assistance.

Best Regards,

Is there anyway I can go ahead and preload these variables ahead of time before actually printing? That way when the user prints it is the same speed each time.

Hi Marc,


Thanks for your feedback. We have shared your query with the product team and will update you as soon as some update is available.

Best Regards,

Hi Marc,


Thanks for your patience. In reference to above requirement, we can provide an interface to initialize print setting of a document. However, we see it will not help much because every change in the document will negate all this initialization work. We will appreciate it if you please share some more details about your scenario in which you need such a preliminary initialization.

Best Regards,

Without going into great detail, one of the primary applications we are concerned with is a public-facing application where the user needs to print something for people. Some of these machines are old and slow so that first “slow” print could take anywhere from 20-40 seconds. If the user has an irate customer, slow printing is not an issue I’d like our users to suffer through.

I had hoped to use aspose to print the word documents needed because all our documents are word documents and converting them to crystal is a pain. However, we had the slow issue with crystal on first run as well, but that was due to loading the crystal objects into memory. We got around that by spawning a thread at start up that preloads crystal so there would be no slowdown. I had hoped there could be a similar methodology with aspose.

Hi Marc,


Thanks for sharing more details. We have passed on the information to our product team and will let you know as soon as some update is available.

Best Regards,

@software.sboencsbe.g,

The issues you have found earlier (filed as WORDSNET-15162) have been fixed in this Aspose.Words for .NET 17.9 update and this Aspose.Words for Java 17.9 update.

A post was split to a new topic: Word document printing performance - Aspose.Words