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

Free Support Forum - aspose.com

Document.Print Exception

Hi,

While 3 users in different web sessions were using the Aspose.Words.Document.Print() method at the same time, one of the users got an exception. Down at System.Drawing.Printing.StandardPrintController.OnEndPrint() method, no corresponding StartdocPrint call had been made. See the attached stack dump.

From my understanding the Aspose.Words.document class and its methods are all instance variables and code and should inherently be reentrant. Am I not using the class and method correctly?

Thanks,
Will Skou

Hi there,


Thanks for your inquiry.

Could you please attach your document and code here for testing? Also does this only happen with this particular document or all documents that you try?

Thanks,

Adam,

Here are the attachments. CodeSnippet1.txt is the Aspose.Words.Document.Print() call.

CodeSnippet2.txt uses thjis method with a series of documents.

TestDoc.doc is the document that didn't print for one of the 3 users, hence the one that was being processed whrn the exception occurred.

Thanks,
Will

Hello


Thank you for additional information. Which version of Aspose.Words you are using? Also does the problem depend on environment? Does this problem occurs on some particular PC or printer?

Do you use network printer? In this case your network printer can be not accessible (e.g. the printer share is password protected) or a problem has occurred in your system printer driver.


Best regards,

Hi Will,

I think you might be using some older version of Aspose.Words because in a simple windows application, I am able to print the document file for 10 times. I used the same word file and code that you have shared. I have used Aspose.Words 10.5 and if you are using an older version, I would suggest you to upgrade to this version.

Andrey,

We're using Aspose.Words 10.3.0.0, the 1.1 Framework DLL. All the user sessions hitting the common code run on our application server. This is a network printer but password protection. We have only seen the problem once when we deliberately set up concurrent printing from 3 user sessions.

The problem hasn't surfaced at all during normal non-concurrent printing activity.

Thanks,
Will

Hi Will,


Thanks for this additional information.

I will do some testing on my side and get back to you with my results.

Thanks,

Hi there,

Thanks for your pateince.

I’m afraid I was unable to reproduce the issue on my side using a concurrent print test to a real printer. I did however do some research and found this exception can be thrown is situations such as when the printer port is unavalible or the printer password is incorrect.

Most likely this issue is not to do with Aspose.Words and is instead caused by something else. For example it may be a problem in the printing framework in .NET, or with a network or printer driver problem on your side or perhaps even with the multithreading code you use to print.

Since the issue is most likely arising from a multi threading envrionment, the best solution would be to do some research into the issue and try to make your own code more resiltant. Hopefully this will avoid the exception in the future.

If we can help with anything else, please feel free to ask.

Thanks,