AsposeWordsPrintDocument

Hello ,

We are using AsposeWordsPrintDocument to print some documents from the serverside. Sometime the print fails with an exception saying “There are no available print services”. It seems that once we get this exception , then one cannot print anymore.

My questions are

1 - What could cause Aspose to throw an error with a message “There are no available print services”. ?

2 - Are there any settings that one need to configure for printing documents concurrently ? ( By multiple users at the same time)

Thanks
Raj

Hi Raj,


Thanks for your inquiry. What development environment (e.g. OS, JDK versions) are you getting this exception on? In case you’re using an older version of Aspose.Words for Java, I would suggest you please upgrade to the latest version (13.12.0) from the following link and see how it goes on your end. I hope, this helps:
http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/default.aspx

Secondly, Aspose.Words for Java supports multi-threading and printing several Word documents at the same time should work perfectly. Please make sure that you are using separate Document instances per each thread. One thread should use one Document object.

Best regards,

Hello Aspose team,

Thanks for your response. The version of JDK that we are using is jdk1.7.0_17. Based on your input we tried using the latest version but without luck. It seems that we get this error when there is a good load on the server , in the sense that there are good number of print requests from the application.

Next to this , we also found another issue that when there are concurrent requests for printing of documents with multiple styles ( First page should pick up paper from tray 1 and the rest of the pages from another tray , which is specified in the template of the word document) , it seems Aspose creates multiple jobs for each style , in this case two print jobs for every document. This results in the ordering issues , where the first page of one document is ordered next to another document in case of concurrent print requests.
Kindly let me know if you need further explanation or more details.

Thanks

Hi Raj,


Thanks for your inquiry. You can find out whether a print service is available before actually sending the document to printer by using the following code:
PrintService prnSvc = null;
PrintService[] pservices = PrintServiceLookup.lookupPrintServices(null, null);
if (pservices.length > 0)
{
int i = 0;
while (i < pservices.length)
{
if (pservices[i].getName().endsWith(“YourPrinterName”))
{
prnSvc = pservices[i];
break;
}
i++;
}
}
if (prnSvc != null)
{
// print documents
}
Unfortunately, Java Printing API doesn’t allow to perform multi-tray-printing in a one-pass i.e. we can specify only one tray per print job. We have an existing issue (WORDSJAVA-817) to try to print all pages in a single print job. Your request has been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

Ok. Thanks for the response. Will try to work around this Java Print API limitation.

Reagards

The issues you have found earlier (filed as WORDSJAVA-817) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(14)