Free Support Forum - aspose.com

Print a document using xpsprinthelper from website

Hi.


We are trying to use your xpsprinthelper class to print documents to a network printer. It works great when we are testing the test project application with the xpsprinterhelper.cs. But when we are trying to use the class inside our website, we always get the following error message. “The device is not ready”. Is this permission related maybe?

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. The problem might occur because you have no rights or the printer name is incorrect. Please make sure that the printer is available as network printer on the PC where you are running the application.

Best regards,

In both cases (in the testproject and the website), I have the same printername. I am testing directly on the server. You say, no rights. What rights? Do I have to run my website with special permissions?

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Aspose.Words uses the same account as is used to run the application, which uses Aspose.Words. Web applications are run under ASPNET (IUSR) user. So you should make sure that these users have rights to print on the specified printer.

Best regards,

I have changed the permission in the app pool for the web application. And I have check the user that runs in both cases (program and website) with this:


System.Security.Principal.WindowsIdentity.GetCurrent().Name;

And I see that it is the same user in both cases. But when I´m trying to print from the website I get the “The device is not ready” error.

I found the solution… I needed to set “Load User Profile” = true to the app pool in the IIS.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

It is perfect, that you already resolved the problem. Please let me know in case of any issues. I will be glad to help you.

Best regards,