Free Support Forum - aspose.com

No printers are installed

Hi, I'm using Aspose.Words to print docx documents through a website (Windows Server 2008, IIS7). I am getting "No printers are installed" error. It only works when the user account is logged in locally on the server. Please advise. Thanks.

Hi Eran,


Thanks for your inquiry. Please make sure that the printer on your server is properly installed and accessible.

In case of using network printer, please make sure that name of the network printer is specified correctly. Make sure that name of the machine is specified correctly. You can try specifying name of network printer using IP address.

PrinterSettings printerSettings = new PrinterSettings();<o:p></o:p>

printerSettings.PrinterName = @"\192.168.0.2\hp LaserJet 1010 Series Driver";<o:p></o:p>

doc.Print(printerSettings);

Also, make sure that you have rights to print on this printer. You can try using the following code for testing. This code does not use Aspose.Words at all. So if it will not work, the problem is somewhere on your side.

PrintDocument doc = new PrintDocument();<o:p></o:p>

doc.PrinterSettings.PrinterName = @"\192.168.0.2\hp LaserJet 1010 Series Driver";<o:p></o:p>

doc.PrintPage += Doc_PrintPage;<o:p></o:p>

doc.Print();

============================================================================

private void Doc_PrintPage(object sender, PrintPageEventArgs e)<o:p></o:p>

{<o:p></o:p>

e.Graphics.DrawImage(Image.FromFile(@“Common\test.jpg”), e.MarginBounds.Left, e.MarginBounds.Top);<o:p></o:p>

}

This code just prints an image. Please let us know if you have any more queries.


Hi,

The code you supply works. The printer is installed locally, but the code above works whether I set the printerName as the local name or the network path (shared printer).

I have narrowed the problem to using PageSettings and setting it to on Aspose.Words.Document.DefaultPageSettings

System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();
Aspose.Words.Document doc0 = new Document(docMemoryStream[0]);
AsposeWordsPrintDocument wpd0 = new AsposeWordsPrintDocument(doc0);
wpd0.PrinterSettings = ps;
wpd0.DefaultPageSettings = pgs;
wpd0.Print();
Calling Print() throws the error "No printers are installed".

Also, the Print() takes over a minute to print a one page document with 2 lines on it.

Please advise,

Thanks.

Hi Eran,


Thanks for your inquiry. Perhaps, you’re using an older version of Aspose.Words; as with Aspose.Words v11.9.0, I was unable to reproduce this problem on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v11.9.0 and let us know how it goes on your side. I hope, this will help.

Hi,

I downloaded v11.9.0 and I still have the same "No printers are installed" issue.

Printing now seems to be hang. It printed 30 minutes later, right after I reran it with the original version that I was using. Coincidence?

Please advise. This is becoming an urgent matter.

Again, this does not happen when I run it locally, but when using IIS7 on Windows 2008 server.

Thanks.

Forgot to include, current version of Aspose.Words.dll is 9.7.0.0.

Hi Eran,


Thanks for sharing the details. Can you please share your scenario again here to avoid any misunderstanding? As per my understanding, your printer is installed at Window Server 2008. Your web application is hosted at Windows Server 2008 and you are accessing web application locally to print document. Please confirm this.

Are you using Windows Server 2008 R2 or Windows Server 2008 32 bit? Please share this also.

We will prepare the required platform (Windows Server 2008) to simulate the environment as of yours. As soon as everything is setup, we will test the issue on our end and will post the results here for your kind reference.

Thank you for your patience and understanding.

Hi,

Webiste is hosted on IIS7 on Windows 2008R2 64-bit.

A webpage has a print button, which uses Aspose.Words.dll to perform a mailmerge on a Word (.dox) document. This works fine.
This is saved as a memory stream and then printed with the code snippet I provided earlier. I use the PageSettings object to
set the PaperSource (printer tray). (Code is in C#)

Running in this scenerio cause the 2 issues I am experiencing.

If I run the code locally using Visual Studios' ASP.NET Development Server (which runs on my local computer), it works.

Thanks,
ED

Hi Eran,


Thanks for the additional information. We are checking with this scenario and will get back to you soon.

Best Regards,

Hi Eran,


Thanks for your patience and sorry for the delayed response. I have tested the scenario and have managed to reproduce the same exception on my side. For the sake of correction, I have logged this problem as WORDSNET-7397 in our issue tracking system. Our developers will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

Thanks for getting back to me. How soon do you think this will be resolved? Do you have a workaround? Thanks, Eran.

Hi Eran,


Thanks for your inquiry. Our development team is currently doing analysis of this issue; so, we can’t provide you any reliable estimate at the moment. Once the issue is analyzed, we will then be able to provide you more information on the ETA. Sorry for the inconvenience.

Best regards,

Hi Eran,


Please setup your printer on the server for the ‘System Account’ using the instructions mentioned here in this blog entry. You will also need to change the identity of the application pool that your app is using to use the LocalSystem identity. Please see the screenshot in the above link. Please let us know if this resolves your problem?

Thanks for your cooperation.

Best regards,
Hi Eran,

It is to update you that our development team has finished working on your issue (WORDSNET-7397) and has come to a conclusion that your issue and the behaviour you're observing is actually not a bug in Aspose.Words. So, we've closed this issue as 'Not a Bug'. If we can help you with anything else, please feel free to ask.

Best regards,